Repository: flex-falcon
Updated Branches:
  refs/heads/develop 3044c462a -> 498716d12


ASBlockWalker: internal classes, interfaces, functions, and variables that 
aren't in a package must appear after a package


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

Branch: refs/heads/develop
Commit: 0df8a51808bb539122729bf93b8471bdb8b59287
Parents: b74b09d
Author: Josh Tynjala <joshtynj...@apache.org>
Authored: Tue Jan 12 11:56:03 2016 -0800
Committer: Josh Tynjala <joshtynj...@apache.org>
Committed: Tue Jan 12 11:56:24 2016 -0800

----------------------------------------------------------------------
 .../internal/codegen/as/ASBlockWalker.java      | 44 +++++++++++++-------
 1 file changed, 28 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0df8a518/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
----------------------------------------------------------------------
diff --git 
a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
 
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
index b405bb0..d31ea74 100644
--- 
a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
+++ 
b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
@@ -179,6 +179,7 @@ public class ASBlockWalker implements IASBlockVisitor, 
IASBlockWalker
     {
         debug("visitFile()");
         
+        boolean foundPackage = false;
         int nodeCount = node.getChildCount();
         for (int i = 0; i < nodeCount; i++)
         {
@@ -187,22 +188,33 @@ public class ASBlockWalker implements IASBlockVisitor, 
IASBlockWalker
                // ToDo (erikdebruin): handle other types of root node, such as 
when
                //                     there is no wrapping Package or Class, 
like
                //                     in mx.core.Version
-               if (pnode != null && 
-                       (pnode instanceof IPackageNode || 
-                        pnode instanceof IInterfaceNode ||
-                        pnode instanceof IClassNode ||
-                 pnode instanceof IFunctionNode ||
-                 pnode instanceof IVariableNode))
-               {
-                   walk(pnode);
-                   
-                       if (i < nodeCount - 1)
-                       {
-                               emitter.writeNewline();
-                               emitter.writeNewline();
-                               emitter.writeNewline();
-                       }
-               }
+               if (pnode != null)
+            { 
+                boolean isPackage = pnode instanceof IPackageNode;
+                boolean isAllowedAfterPackage = false;
+                if(isPackage)
+                {
+                    foundPackage = true;
+                }
+                else if(foundPackage)
+                {
+                    isAllowedAfterPackage = pnode instanceof IInterfaceNode
+                        || pnode instanceof IClassNode
+                        || pnode instanceof IFunctionNode
+                        || pnode instanceof IVariableNode;
+                }
+                if(isPackage || isAllowedAfterPackage)
+                {
+                    walk(pnode);
+                    
+                    if (i < nodeCount - 1)
+                    {
+                        emitter.writeNewline();
+                        emitter.writeNewline();
+                        emitter.writeNewline();
+                    }
+                }
+            }
         }
     }
 

Reply via email to