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 2019/11/26 18:09:18 UTC

[royale-compiler] branch develop updated: MXMLTreeBuilder: add missing error for text that cannot be converted into a non-primitive type (class or interface)

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 dc3b2cd  MXMLTreeBuilder: add missing error for text that cannot be converted into a non-primitive type (class or interface)
dc3b2cd is described below

commit dc3b2cd139ae2982b7f767d6653e9cdf7b8256e9
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Nov 26 10:09:11 2019 -0800

    MXMLTreeBuilder: add missing error for text that cannot be converted into a non-primitive type (class or interface)
    
    The Flex SDK compiler reports an error for this situation, but Royale did not yet.
---
 .../royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java       | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java
index 07291f8..a054f32 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java
@@ -496,6 +496,14 @@ public class MXMLTreeBuilder
                 return null;
             }
         }
+        if (value == null)
+        {
+            // we can't parse null from text alone
+            // to pass null, you need to use binding like {null}
+            // with that in mind, a null value here means that the text is
+            // invalid for the specified type
+            return null;
+        }
         
         MXMLLiteralNode literalNode = new MXMLLiteralNode(null, value);
         literalNode.setSourceLocation(location);