Skip to content

Commit

Permalink
Fix class cast expression for use of local variables
Browse files Browse the repository at this point in the history
  • Loading branch information
niveathika committed Oct 17, 2023
1 parent 6912f48 commit aa2854b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

### Changed
- [Fix class cast exception when executing query with non-global variable](https://github.com/ballerina-platform/persist-tools/issues/311)

## [1.2.0] - 2023-09-18

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ public void perform(SyntaxNodeAnalysisContext ctx) {

private Query isQueryUsingPersistentClient(FromClauseNode fromClauseNode) {
if (fromClauseNode.expression() instanceof ClientResourceAccessActionNode remoteCall) {
if (remoteCall.expression().kind() != SyntaxKind.SIMPLE_NAME_REFERENCE) {
// This improvement is tracked in https://github.com/ballerina-platform/ballerina-standard-library/issues/4943
return null;
}
SimpleNameReferenceNode clientName = (SimpleNameReferenceNode) remoteCall.expression();
Collection<ChildNodeEntry> clientResourceChildEntries = remoteCall.childEntries();
if (clientResourceChildEntries.size() == 5 || clientResourceChildEntries.size() == 7) {
Expand Down

0 comments on commit aa2854b

Please sign in to comment.