You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jo...@apache.org on 2016/01/09 07:14:08 UTC

[4/4] git commit: [flex-falcon] [refs/heads/develop] - JSGoogEmitter: emitPackageContents() now handles IVariableDefinition and IFunctionDefinition, in addition to the existing handling of ITypeDefinition. These represent package-level variables and func

JSGoogEmitter: emitPackageContents() now handles IVariableDefinition and IFunctionDefinition, in addition to the existing handling of ITypeDefinition. These represent package-level variables and functions.


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

Branch: refs/heads/develop
Commit: 0c69c38ad75368e98e5f2a7c43a50ce3f46fb05d
Parents: aaeeaee
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Jan 8 22:13:16 2016 -0800
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Jan 8 22:13:16 2016 -0800

----------------------------------------------------------------------
 .../internal/codegen/js/goog/JSGoogEmitter.java | 32 +++++++++++++++++---
 1 file changed, 28 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0c69c38a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
index 152d7be..9156926 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/goog/JSGoogEmitter.java
@@ -35,6 +35,7 @@ import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.definitions.IFunctionDefinition;
 import org.apache.flex.compiler.definitions.IPackageDefinition;
 import org.apache.flex.compiler.definitions.ITypeDefinition;
+import org.apache.flex.compiler.definitions.IVariableDefinition;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSEmitter;
 import org.apache.flex.compiler.internal.codegen.js.JSEmitterTokens;
@@ -170,14 +171,37 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
     public void emitPackageContents(IPackageDefinition definition)
     {
         IASScope containedScope = definition.getContainedScope();
+        
         ITypeDefinition type = findType(containedScope.getAllLocalDefinitions());
-        if (type == null)
+        if (type != null)
+        {
+            ITypeNode tnode = findTypeNode(definition.getNode());
+            if (tnode != null)
+            {
+                getWalker().walk(tnode); // IClassNode | IInterfaceNode
+            }
+            return;
+        }
+        
+        IFunctionDefinition func = findFunction(containedScope.getAllLocalDefinitions());
+        if (func != null)
+        {
+            IFunctionNode fnode = findFunctionNode(definition.getNode());
+            if (fnode != null)
+            {
+                getWalker().walk(fnode);
+            }
             return;
+        }
 
-        ITypeNode tnode = findTypeNode(definition.getNode());
-        if (tnode != null)
+        IVariableDefinition variable = findVariable(containedScope.getAllLocalDefinitions());
+        if (variable != null)
         {
-            getWalker().walk(tnode); // IClassNode | IInterfaceNode
+            IVariableNode vnode = findVariableNode(definition.getNode());
+            if (vnode != null)
+            {
+                getWalker().walk(vnode);
+            }
         }
     }