You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/11/13 21:03:20 UTC

[2/3] git commit: [flex-falcon] [refs/heads/develop] - redo undefined member error reporting

redo undefined member error reporting


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/b7f382d9
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/b7f382d9
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/b7f382d9

Branch: refs/heads/develop
Commit: b7f382d903fa488d5dc80a5871fcc887082a78c5
Parents: 9f24eba
Author: Alex Harui <ah...@apache.org>
Authored: Fri Nov 13 11:56:10 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Nov 13 11:56:10 2015 -0800

----------------------------------------------------------------------
 .../semantics/MethodBodySemanticChecker.java    | 21 ++++++++++++++++++++
 .../internal/tree/as/IdentifierNode.java        |  7 ++++---
 2 files changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b7f382d9/compiler/src/org/apache/flex/compiler/internal/semantics/MethodBodySemanticChecker.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/semantics/MethodBodySemanticChecker.java b/compiler/src/org/apache/flex/compiler/internal/semantics/MethodBodySemanticChecker.java
index ba31e09..67a934b 100644
--- a/compiler/src/org/apache/flex/compiler/internal/semantics/MethodBodySemanticChecker.java
+++ b/compiler/src/org/apache/flex/compiler/internal/semantics/MethodBodySemanticChecker.java
@@ -1685,6 +1685,8 @@ public class MethodBodySemanticChecker
      */
     private ICompilerProblem accessUndefinedProperty(Binding b, IASNode iNode)
     {
+        ICompilerProblem problem;
+        
         String unknown_name = null;
 
         if ( b.getName() != null )
@@ -1707,6 +1709,10 @@ public class MethodBodySemanticChecker
                 );
             }
         }
+        else if ((problem = isMissingMember(b.getNode())) != null)
+        {
+            return problem;
+        }
         else if ( utils.isInInstanceFunction(iNode) && utils.isInaccessible((ASScope)utils.getEnclosingFunctionDefinition(iNode).getContainingScope(), b) )
         {
             return new InaccessiblePropertyReferenceProblem(
@@ -1719,6 +1725,21 @@ public class MethodBodySemanticChecker
         return new AccessUndefinedPropertyProblem(iNode, unknown_name);
     }
     
+    public ICompilerProblem isMissingMember(IASNode iNode)
+    {
+        if (iNode instanceof IdentifierNode && iNode.getParent() instanceof MemberAccessExpressionNode)
+        {
+            MemberAccessExpressionNode mae = (MemberAccessExpressionNode)(iNode.getParent());
+            if (iNode == mae.getRightOperandNode())
+            {
+                ITypeDefinition leftDef = mae.getLeftOperandNode().resolveType(project);
+                if (!leftDef.isDynamic())
+                    return new AccessUndefinedMemberProblem(iNode, ((IdentifierNode)iNode).getName(), leftDef.getQualifiedName());
+            }
+        }
+        return null;
+    }
+    
     /**
      *  Ensure a super-qualified access is in an instance method.
      */

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b7f382d9/compiler/src/org/apache/flex/compiler/internal/tree/as/IdentifierNode.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/tree/as/IdentifierNode.java b/compiler/src/org/apache/flex/compiler/internal/tree/as/IdentifierNode.java
index 95ab0c3..c47a48a 100644
--- a/compiler/src/org/apache/flex/compiler/internal/tree/as/IdentifierNode.java
+++ b/compiler/src/org/apache/flex/compiler/internal/tree/as/IdentifierNode.java
@@ -462,9 +462,10 @@ public class IdentifierNode extends ExpressionNodeBase implements IIdentifierNod
                     ITypeDefinition leftDef = mae.getLeftOperandNode().resolveType(project);
                     if (leftDef != null && leftDef.isDynamic() == false)
                     {
-                        AccessUndefinedMemberProblem aump = new AccessUndefinedMemberProblem(this, getName(), leftDef.getQualifiedName());
-                        project.getProblems().add(aump);
-                        return null;
+                        INamespaceReference nr = leftDef.getNamespaceReference();
+                        INamespaceDefinition nd = nr.resolveNamespaceReference(project);
+                        Set<INamespaceDefinition> nsset = ImmutableSet.of((INamespaceDefinition)nd);
+                        return makeName(nsset, getName(), isAttributeIdentifier());
                     }
                 }
             }