You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/11/16 06:51:09 UTC
[royale-compiler] 02/02: catch super calls to methods that don't
exist
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 660fff90b3daae204794dcbc3762c2e7471803eb
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Nov 15 14:55:41 2018 -0800
catch super calls to methods that don't exist
---
.../internal/semantics/MethodBodySemanticChecker.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
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 6663afc..3b0e7e3 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
@@ -70,6 +70,7 @@ import org.apache.royale.compiler.internal.definitions.AmbiguousDefinition;
import org.apache.royale.compiler.internal.definitions.VariableDefinition;
import org.apache.royale.compiler.problems.*;
import org.apache.royale.compiler.projects.ICompilerProject;
+import org.apache.royale.compiler.tree.ASTNodeID;
import org.apache.royale.compiler.tree.as.IASNode;
import org.apache.royale.compiler.tree.as.IBinaryOperatorNode;
import org.apache.royale.compiler.tree.as.ICompoundAssignmentNode;
@@ -1793,6 +1794,21 @@ public class MethodBodySemanticChecker
IExpressionNode site = ((IMemberAccessExpressionNode)nameNode).getRightOperandNode();
def = ((IFunctionCallNode)iNode).resolveCalledExpression(project);
checkDeprecated(site, def);
+ if (def == null)
+ {
+ String methodName = null;
+ if (nameNode.getNodeID() == ASTNodeID.MemberAccessExpressionID)
+ {
+ MemberAccessExpressionNode mae = (MemberAccessExpressionNode)nameNode;
+ IExpressionNode rightNode = mae.getRightOperandNode();
+ if (rightNode.getNodeID() == ASTNodeID.IdentifierID)
+ methodName = ((IdentifierNode)rightNode).getName();
+ }
+ assert methodName != null;
+ addProblem(new CallUndefinedMethodProblem(
+ iNode, methodName
+ ));
+ }
}
if ( this.superState == SuperState.Initial )