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 2022/12/12 23:53:42 UTC

[royale-compiler] branch develop updated (4198ddd0b -> 5f1c0f965)

This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git


    from 4198ddd0b compiler-jx: a couple of missing tests for date properties
     new 9c7cbc171 MemberAccessExpressionNode: remove setAllowE4XFilter() from commit 86b4fff
     new dc82b3c58 ArrayLikeUtil: fix null exception when dynamic access node is [] (empty)
     new 5f1c0f965 Tests: null conditional with dynamic access should result in compiler error

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../royale/compiler/internal/parsing/as/BaseASParser.java |  2 --
 .../internal/tree/as/MemberAccessExpressionNode.java      |  9 +--------
 .../main/java/org/apache/royale/utils/ArrayLikeUtil.java  |  7 ++++++-
 .../src/test/java/as/ASNullConditionalOperatorTests.java  | 15 +++++++++++++++
 4 files changed, 22 insertions(+), 11 deletions(-)


[royale-compiler] 02/03: ArrayLikeUtil: fix null exception when dynamic access node is [] (empty)

Posted by jo...@apache.org.
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

commit dc82b3c5849633c198c633c3b02460c73c66d952
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon Dec 12 15:43:10 2022 -0800

    ArrayLikeUtil: fix null exception when dynamic access node is [] (empty)
---
 compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java b/compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java
index dce18747e..13f4459c6 100644
--- a/compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java
+++ b/compiler/src/main/java/org/apache/royale/utils/ArrayLikeUtil.java
@@ -281,8 +281,13 @@ public class ArrayLikeUtil
             return false;
         }
         boolean isCandidate = false;
+        IDefinition dynType = null;
+        IExpressionNode rightNode = dynNode.getRightOperandNode();
+        if (rightNode != null)
+        {
+            dynType = rightNode.resolveType(project);
+        }
         //first check to see if the access is numeric... if it is not then we consider that it is not a candidate
-        IDefinition dynType = dynNode.getRightOperandNode().resolveType(project);
         if (project.getBuiltinType(IASLanguageConstants.BuiltinType.NUMBER).equals(dynType)
                 || project.getBuiltinType(IASLanguageConstants.BuiltinType.UINT).equals(dynType)
                 || project.getBuiltinType(IASLanguageConstants.BuiltinType.INT).equals(dynType)


[royale-compiler] 01/03: MemberAccessExpressionNode: remove setAllowE4XFilter() from commit 86b4fff

Posted by jo...@apache.org.
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

commit 9c7cbc1717a4a1de7627407599a0d59d433ffe21
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon Dec 12 15:38:04 2022 -0800

    MemberAccessExpressionNode: remove setAllowE4XFilter() from commit 86b4fff
    
    Not necessary for now. Will reconsider if ?.() function calls are to be supported
---
 .../apache/royale/compiler/internal/parsing/as/BaseASParser.java | 2 --
 .../compiler/internal/tree/as/MemberAccessExpressionNode.java    | 9 +--------
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
index 7174b62f4..20493a54e 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
@@ -3175,7 +3175,6 @@ abstract class BaseASParser extends LLkParser implements IProblemReporter
         {
             ASToken memberAccessOperator = new ASToken(ASTokenTypes.TOKEN_OPERATOR_MEMBER_ACCESS, op.getStart(), op.getEnd(), op.getLine(), op.getColumn(), ".");
             MemberAccessExpressionNode memberAccessNode = new MemberAccessExpressionNode(prevRightNode, memberAccessOperator, r);
-            memberAccessNode.setAllowE4XFilter(false);
 
             ASToken ternaryOperator = new ASToken(ASTokenTypes.TOKEN_OPERATOR_TERNARY, -1, -1, -1, -1, "?");
             ASToken innerResultNullToken = new ASToken(ASTokenTypes.TOKEN_KEYWORD_NULL, -1, -1, -1, -1, "null");
@@ -3207,7 +3206,6 @@ abstract class BaseASParser extends LLkParser implements IProblemReporter
 
         ASToken memberAccessOperator = new ASToken(ASTokenTypes.TOKEN_OPERATOR_MEMBER_ACCESS, op.getStart(), op.getEnd(), op.getLine(), op.getColumn(), ".");
         MemberAccessExpressionNode memberAccessNode = new MemberAccessExpressionNode(l, memberAccessOperator, r);
-        memberAccessNode.setAllowE4XFilter(false);
 
         ASToken ternaryOperator = new ASToken(ASTokenTypes.TOKEN_OPERATOR_TERNARY, -1, -1, -1, -1, "?");
         ASToken resultNullToken = new ASToken(ASTokenTypes.TOKEN_KEYWORD_NULL, -1, -1, -1, -1, "null");
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/MemberAccessExpressionNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/MemberAccessExpressionNode.java
index 59a7484db..42d77b8ff 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/MemberAccessExpressionNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/MemberAccessExpressionNode.java
@@ -96,7 +96,7 @@ public class MemberAccessExpressionNode extends BinaryOperatorNodeBase implement
         {
             nodeID = ASTNodeID.Op_DescendantsID;
         }
-        else if (allowE4XFilter && rightOperandNode != null && rightOperandNode.hasParenthesis())
+        else if (rightOperandNode != null && rightOperandNode.hasParenthesis())
         {
             nodeID = ASTNodeID.E4XFilterID;
         }
@@ -264,13 +264,6 @@ public class MemberAccessExpressionNode extends BinaryOperatorNodeBase implement
     // Other methods
     //
 
-    private boolean allowE4XFilter = true;
-
-    public void setAllowE4XFilter(boolean allow)
-    {
-        allowE4XFilter = allow;
-    }
-
     public boolean isSuper(ExpressionNodeBase node)
     {
         if (!(node instanceof ILanguageIdentifierNode))


[royale-compiler] 03/03: Tests: null conditional with dynamic access should result in compiler error

Posted by jo...@apache.org.
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

commit 5f1c0f9657d0a7b5f738c1af8e7ff6e6081325bb
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon Dec 12 15:53:19 2022 -0800

    Tests: null conditional with dynamic access should result in compiler error
---
 .../src/test/java/as/ASNullConditionalOperatorTests.java  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/compiler/src/test/java/as/ASNullConditionalOperatorTests.java b/compiler/src/test/java/as/ASNullConditionalOperatorTests.java
index ed045b524..96998209e 100644
--- a/compiler/src/test/java/as/ASNullConditionalOperatorTests.java
+++ b/compiler/src/test/java/as/ASNullConditionalOperatorTests.java
@@ -184,4 +184,19 @@ public class ASNullConditionalOperatorTests extends ASFeatureTestsBase
 
         compileAndRun(source);
     }
+
+	@Test
+    public void testNullConditionalArrayAccess()
+    {
+        String[] testCode = new String[]
+        {
+            "var o:Object = {};",
+			"var result:* = o?.a?.[0];",
+        };
+        String source = getAS(new String[0], new String[0], testCode, new String[0]);
+
+        compileAndExpectErrors(source, false, false, false, new String[0], "'[' is not allowed here\n");
+    }
+
+
 }
\ No newline at end of file