You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2023/01/24 23:26:57 UTC
[royale-compiler] branch develop updated: ASParser: ensure that a function call end offset always includes the ) token
This is an automated email from the ASF dual-hosted git repository.
joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
The following commit(s) were added to refs/heads/develop by this push:
new dcc026bf8 ASParser: ensure that a function call end offset always includes the ) token
dcc026bf8 is described below
commit dcc026bf8b961f67035f74f2b18a7a9830687ac0
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Jan 24 15:26:28 2023 -0800
ASParser: ensure that a function call end offset always includes the ) token
Previously, if there was nothing between the , and ) tokens, the end offset was the , token, which could break things like code intelligence in IDEs
---
.../org/apache/royale/compiler/internal/parsing/as/ASParser.g | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/compiler/src/main/antlr/org/apache/royale/compiler/internal/parsing/as/ASParser.g b/compiler/src/main/antlr/org/apache/royale/compiler/internal/parsing/as/ASParser.g
index 00a2b8084..a4ee25dfd 100644
--- a/compiler/src/main/antlr/org/apache/royale/compiler/internal/parsing/as/ASParser.g
+++ b/compiler/src/main/antlr/org/apache/royale/compiler/internal/parsing/as/ASParser.g
@@ -3294,6 +3294,7 @@ argumentList[ContainerNode args]
{
ExpressionNodeBase n = null;
boolean foundFirstArg = false;
+ Token afterComma = null;
}
: ( n=assignmentExpression
{ foundFirstArg = true; if (args != null) args.addItem(n); }
@@ -3317,12 +3318,21 @@ argumentList[ContainerNode args]
if (n!= null && args != null) args.addItem(n);
}
if (args != null) args.endAfter(commaT);
+ afterComma = LT(1);
}
n=assignmentExpression
{
if(n == null)
+ {
n = handleMissingIdentifier(null);
+ // special case: nothing between "," and ")"
+ // ensures that args ends at the correct offset
+ if(afterComma.getType() == TOKEN_PAREN_CLOSE)
+ {
+ args.endAfter(afterComma);
+ }
+ }
if (args != null)
args.addItem(n);