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/20 17:37:47 UTC

[royale-compiler] branch develop updated (ec3b53c -> d5b247e)

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 ec3b53c  need to handle a read-only property being converted to readwrite in the subclass
     new 39945b1  DefinitionBase: fixed issue where getArrayElementType() incorrectly returned null for properties with [InstanceType(Array)] metadata
     new d5b247e  MXMLArrayNode: fixed issue where ArrayElementType was enforced for some arrays, but not ones with [DefaultProperty]

The 2 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:
 .../internal/definitions/DefinitionBase.java       |  3 ++-
 .../compiler/internal/tree/mxml/MXMLArrayNode.java | 23 ++++++++++++++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)


[royale-compiler] 02/02: MXMLArrayNode: fixed issue where ArrayElementType was enforced for some arrays, but not ones with [DefaultProperty]

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

View the commit online:
https://github.com/apache/royale-compiler/commit/d5b247ec9b5a8a30ed74c35a5b7dd1850f966ec1

commit d5b247ec9b5a8a30ed74c35a5b7dd1850f966ec1
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Wed Nov 20 09:37:39 2019 -0800

    MXMLArrayNode: fixed issue where ArrayElementType was enforced for some arrays, but not ones with [DefaultProperty]
    
    This is a compatibility fix where the Flex SDK compiler enforced it, but the Royale compiler has not been enforcing it.
---
 .../compiler/internal/tree/mxml/MXMLArrayNode.java | 23 ++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLArrayNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLArrayNode.java
index 9d7984f..af2ec7e 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLArrayNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLArrayNode.java
@@ -138,11 +138,11 @@ class MXMLArrayNode extends MXMLInstanceNode implements IMXMLArrayNode
 
         String tagName = builder.getFileScope().resolveTagToQualifiedName(childTag);
         IDefinition definition = project.getScope().findDefinitionByName(tagName);
-        if (definition instanceof ClassDefinition)
+        if (definition instanceof IClassDefinition)
         {
             MXMLInstanceNode instanceNode =
                     MXMLInstanceNode.createInstanceNode(builder, tagName, this);
-            instanceNode.setClassReference(project, (ClassDefinition)definition); // TODO Move this logic to initializeFromTag().
+            instanceNode.setClassReference(project, (IClassDefinition)definition); // TODO Move this logic to initializeFromTag().
             instanceNode.initializeFromTag(builder, childTag);
             info.addChildNode(instanceNode);
 
@@ -150,7 +150,7 @@ class MXMLArrayNode extends MXMLInstanceNode implements IMXMLArrayNode
             // the [ArrayElementType] of the property of type Array that's being set.
             if (arrayElementType != null)
             {
-                if (!((ClassDefinition)definition).isInstanceOf(arrayElementType, project))
+                if (!((IClassDefinition)definition).isInstanceOf(arrayElementType, project))
                 {
                     ICompilerProblem problem = new MXMLIncompatibleArrayElementProblem(
                             childTag, propertyName, arrayElementType, definition.getQualifiedName());
@@ -233,6 +233,9 @@ class MXMLArrayNode extends MXMLInstanceNode implements IMXMLArrayNode
 
         setClassReference(project, IASLanguageConstants.Array);
 
+        propertyName = defaultPropertyDefinition.getBaseName();
+        arrayElementType = defaultPropertyDefinition.getArrayElementType(project);
+
         List<IMXMLNode> children = new ArrayList<IMXMLNode>();
         for (IMXMLUnitData unit : contentUnits)
         {
@@ -258,9 +261,21 @@ class MXMLArrayNode extends MXMLInstanceNode implements IMXMLArrayNode
                     {
                         MXMLInstanceNode childNode = MXMLInstanceNode.createInstanceNode(
                                 builder, definition.getQualifiedName(), this);
-                        childNode.setClassReference(project, (ClassDefinition)definition); // TODO Move this logic to initializeFromTag().
+                        childNode.setClassReference(project, (IClassDefinition)definition); // TODO Move this logic to initializeFromTag().
                         childNode.initializeFromTag(builder, tag);
                         children.add(childNode);
+
+                        // Report problem if actual type of array element is incompatible with
+                        // the [ArrayElementType] of the property of type Array that's being set.
+                        if (arrayElementType != null)
+                        {
+                            if (!((IClassDefinition)definition).isInstanceOf(arrayElementType, project))
+                            {
+                                ICompilerProblem problem = new MXMLIncompatibleArrayElementProblem(
+                                    tag, propertyName, arrayElementType, definition.getQualifiedName());
+                                builder.addProblem(problem);
+                            }
+                        }
                     }
                     else
                     {


[royale-compiler] 01/02: DefinitionBase: fixed issue where getArrayElementType() incorrectly returned null for properties with [InstanceType(Array)] metadata

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

View the commit online:
https://github.com/apache/royale-compiler/commit/39945b1b19938fca6401c6c3ae172daa818748e1

commit 39945b1b19938fca6401c6c3ae172daa818748e1
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Wed Nov 20 09:12:42 2019 -0800

    DefinitionBase: fixed issue where getArrayElementType() incorrectly returned null for properties with [InstanceType(Array)] metadata
---
 .../apache/royale/compiler/internal/definitions/DefinitionBase.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java
index 50a4951..41da6b2 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java
@@ -1505,7 +1505,8 @@ public abstract class DefinitionBase implements IDocumentableDefinition, IDefini
      */
     public String getArrayElementType(ICompilerProject project)
     {
-        if (getTypeAsDisplayString().equals(IASLanguageConstants.Array))
+        if (getTypeAsDisplayString().equals(IASLanguageConstants.Array)
+                || IASLanguageConstants.Array.equals(getInstanceType(project)))
         {
             return getPropertyMetaTagValue(
                     (RoyaleProject)project, IMetaAttributeConstants.ATTRIBUTE_ARRAYELEMENTTYPE);