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 2020/10/14 17:34:57 UTC

[royale-compiler] branch develop updated: MethodBodySemanticChecker: add missing semantic checks for variables that have [Bindable] metadata (closes #155)

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 7acb9fe  MethodBodySemanticChecker: add missing semantic checks for variables that have [Bindable] metadata (closes #155)
7acb9fe is described below

commit 7acb9fefcccc9862337d04fd848e7019f34b776d
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Wed Oct 14 10:13:02 2020 -0700

    MethodBodySemanticChecker: add missing semantic checks for variables that have [Bindable] metadata (closes #155)
    
    This may cause new compiler errors in projects that were compiling fine before. That's expected because the compiler completely failed to detect these problems previously.
---
 .../internal/semantics/MethodBodySemanticChecker.java   | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/semantics/MethodBodySemanticChecker.java b/compiler/src/main/java/org/apache/royale/compiler/internal/semantics/MethodBodySemanticChecker.java
index af86af1..f76d19b 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/semantics/MethodBodySemanticChecker.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/semantics/MethodBodySemanticChecker.java
@@ -595,6 +595,8 @@ public class MethodBodySemanticChecker
         {
             this.currentScope.addProblem(new LocalBindablePropertyProblem(iNode));
         }
+        
+        checkVariableDeclaration(iNode);
     }
     
     /**
@@ -2614,7 +2616,7 @@ public class MethodBodySemanticChecker
 
         //  Check for ambiguity.
         IDefinition def = utils.getDefinition(var);
-        checkVariableForConflictingDefinitions(iNode, (VariableDefinition)def);
+        checkVariableForConflictingDefinitions(iNode, (IVariableDefinition)def);
 
         checkNamespaceOfDefinition(var, def, project);
         
@@ -2666,11 +2668,14 @@ public class MethodBodySemanticChecker
             checkAssignmentValue(def, rightNode);
         }
 
-        if(SemanticUtils.isNestedClassProperty(iNode, (VariableDefinition)def))
+        if(def instanceof VariableDefinition)
         {
-            // TODO: Issue a better, mor specific diagnostic
-            // TODO: once we are allowed to add new error strings.
-            addProblem(new BURMDiagnosticNotAllowedHereProblem(iNode));
+            if(SemanticUtils.isNestedClassProperty(iNode, (VariableDefinition)def))
+            {
+                // TODO: Issue a better, mor specific diagnostic
+                // TODO: once we are allowed to add new error strings.
+                addProblem(new BURMDiagnosticNotAllowedHereProblem(iNode));
+            }
         }
     }
 
@@ -3043,7 +3048,7 @@ public class MethodBodySemanticChecker
      * @param iNode     The node that produced the variable definition.  Used for location info for any diagnostics.
      * @param varDef   The VariableDefinition of the variable to check
      */
-    public void checkVariableForConflictingDefinitions( IASNode iNode, VariableDefinition varDef )
+    public void checkVariableForConflictingDefinitions( IASNode iNode, IVariableDefinition varDef )
     {
         MultiDefinitionType ambiguity = SemanticUtils.getMultiDefinitionType(varDef, project);
         if (ambiguity != MultiDefinitionType.NONE)