ASEmitter: added findFunction(), findFunctionNode(), findVariable(), and 
findVariableNode(), similar to findType() and findTypeNode(). These will be 
used to enable missing for package-level functions and variables


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

Branch: refs/heads/develop
Commit: f427b88a70d700bbcfc95807b8e6769b03977204
Parents: 0fde35f
Author: Josh Tynjala <[email protected]>
Authored: Fri Jan 8 21:57:26 2016 -0800
Committer: Josh Tynjala <[email protected]>
Committed: Fri Jan 8 21:57:26 2016 -0800

----------------------------------------------------------------------
 .../compiler/internal/codegen/as/ASEmitter.java | 44 ++++++++++++++++++++
 1 file changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f427b88a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java 
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
index 8223ee9..9118e95 100644
--- 
a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
+++ 
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
@@ -1145,6 +1145,30 @@ public class ASEmitter implements IASEmitter, IEmitter
         }
         return null;
     }
+    
+    protected IFunctionNode findFunctionNode(IPackageNode node)
+    {
+        IScopedNode scope = node.getScopedNode();
+        for (int i = 0; i < scope.getChildCount(); i++)
+        {
+            IASNode child = scope.getChild(i);
+            if (child instanceof IFunctionNode)
+                return (IFunctionNode) child;
+        }
+        return null;
+    }
+
+    protected IVariableNode findVariableNode(IPackageNode node)
+    {
+        IScopedNode scope = node.getScopedNode();
+        for (int i = 0; i < scope.getChildCount(); i++)
+        {
+            IASNode child = scope.getChild(i);
+            if (child instanceof IVariableNode)
+                return (IVariableNode) child;
+        }
+        return null;
+    }
 
     protected ITypeDefinition findType(Collection<IDefinition> definitions)
     {
@@ -1156,6 +1180,26 @@ public class ASEmitter implements IASEmitter, IEmitter
         return null;
     }
 
+    protected IFunctionDefinition findFunction(Collection<IDefinition> 
definitions)
+    {
+        for (IDefinition definition : definitions)
+        {
+            if (definition instanceof IFunctionDefinition)
+                return (IFunctionDefinition) definition;
+        }
+        return null;
+    }
+
+    protected IVariableDefinition findVariable(Collection<IDefinition> 
definitions)
+    {
+        for (IDefinition definition : definitions)
+        {
+            if (definition instanceof IVariableDefinition)
+                return (IVariableDefinition) definition;
+        }
+        return null;
+    }
+
     public void walkArguments(IExpressionNode[] nodes)
     {
         int len = nodes.length;

Reply via email to