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 2018/05/03 19:04:44 UTC

[royale-compiler] branch develop updated: compiler: fixed issue in MXMLTreeBuilder where invalid Number, int, uint, and Boolean values for properties in MXML were not producing compiler errors.

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 52f24d4  compiler: fixed issue in MXMLTreeBuilder where invalid Number, int, uint, and Boolean values for properties in MXML were not producing compiler errors.
52f24d4 is described below

commit 52f24d44a2185b6553bfc26dd6067662925b70af
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Thu May 3 11:57:42 2018 -0700

    compiler: fixed issue in MXMLTreeBuilder where invalid Number, int, uint, and Boolean values for properties in MXML were not producing compiler errors.
    
    For example, you could set a property of type Number to the string 'abc' and it would be allowed.
---
 .../royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java      | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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 08b47fc..2fe0ecb 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
@@ -468,11 +468,18 @@ public class MXMLTreeBuilder
         {
             String typeName = type.getQualifiedName();
             if (typeName.equals(IASLanguageConstants.String) ||
-                typeName.equals(IASLanguageConstants.Object)||
+                typeName.equals(IASLanguageConstants.Object) ||
                 typeName.equals(IASLanguageConstants.ANY_TYPE))
             {
                 value = "";
             }
+            if (typeName.equals(IASLanguageConstants.Number) ||
+                typeName.equals(IASLanguageConstants._int) ||
+                typeName.equals(IASLanguageConstants.uint) ||
+                typeName.equals(IASLanguageConstants.Boolean))
+            {
+                return null;
+            }
         }
         
         MXMLLiteralNode literalNode = new MXMLLiteralNode(null, value);

-- 
To stop receiving notification emails like this one, please contact
joshtynjala@apache.org.