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.
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 @@
{
this.currentScope.addProblem(new LocalBindablePropertyProblem(iNode));
}
+
+ checkVariableDeclaration(iNode);
}
/**
@@ -2614,7 +2616,7 @@
// Check for ambiguity.
IDefinition def = utils.getDefinition(var);
- checkVariableForConflictingDefinitions(iNode, (VariableDefinition)def);
+ checkVariableForConflictingDefinitions(iNode, (IVariableDefinition)def);
checkNamespaceOfDefinition(var, def, project);
@@ -2666,11 +2668,14 @@
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 @@
* @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)