You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2016/04/11 15:59:28 UTC

[01/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - source map improvements for as/is/casting, binary operators, class fields and methods, object/array literals, and better names field in the source map

Repository: flex-falcon
Updated Branches:
  refs/heads/feature/maven-migration f2ae6be7c -> 39cad676d


source map improvements for as/is/casting, binary operators, class fields and methods, object/array literals, and better names field in the source map


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

Branch: refs/heads/feature/maven-migration
Commit: ad6f1d04d19284515305353c730ef2c77d4e4fd6
Parents: 4b3f7be
Author: Josh Tynjala <jo...@apache.org>
Authored: Sat Mar 26 15:37:42 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Sat Mar 26 15:37:42 2016 -0700

----------------------------------------------------------------------
 .../flex/compiler/codegen/js/IJSEmitter.java    |   3 +
 .../compiler/internal/codegen/js/JSEmitter.java | 140 +++++++++++++++----
 .../codegen/js/flexjs/JSFlexJSEmitter.java      |   4 +-
 .../internal/codegen/js/jx/AsIsEmitter.java     |  46 +++++-
 .../codegen/js/jx/BinaryOperatorEmitter.java    |   5 +-
 .../internal/codegen/js/jx/ClassEmitter.java    |   4 +
 .../internal/codegen/js/jx/FieldEmitter.java    |   8 +-
 .../codegen/js/jx/FunctionCallEmitter.java      |   4 +-
 .../internal/codegen/js/jx/MethodEmitter.java   |  20 ++-
 .../codegen/js/jx/PackageFooterEmitter.java     |   1 +
 .../codegen/js/jx/PackageHeaderEmitter.java     |   2 +
 11 files changed, 189 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ad6f1d04/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
index f660fc3..6aa7f61 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
@@ -45,7 +45,10 @@ public interface IJSEmitter extends IASEmitter
     String formatQualifiedName(String name);
     
     void startMapping(ISourceLocation node);
+    void startMapping(ISourceLocation node, int startOffset);
     void endMapping(ISourceLocation node);
+    void pushSourceMapName(ISourceLocation node);
+    void popSourceMapName();
     
     void emitSourceMapDirective(ITypeNode node);
     

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ad6f1d04/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index 7e29a08..c830f73 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -22,33 +22,38 @@ package org.apache.flex.compiler.internal.codegen.js;
 import java.io.FilterWriter;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Stack;
 
-import com.google.debugging.sourcemap.FilePosition;
 import org.apache.flex.compiler.clients.JSConfiguration;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
 import org.apache.flex.compiler.common.ASModifier;
 import org.apache.flex.compiler.common.ISourceLocation;
-import org.apache.flex.compiler.definitions.IClassDefinition;
 import org.apache.flex.compiler.definitions.ITypeDefinition;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitter;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
+import org.apache.flex.compiler.internal.tree.as.ContainerNode;
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
 import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IContainerNode;
 import org.apache.flex.compiler.tree.as.IDefinitionNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
 import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
 import org.apache.flex.compiler.tree.as.IKeywordNode;
+import org.apache.flex.compiler.tree.as.ILiteralContainerNode;
 import org.apache.flex.compiler.tree.as.INumericLiteralNode;
+import org.apache.flex.compiler.tree.as.IPackageNode;
 import org.apache.flex.compiler.tree.as.IParameterNode;
 import org.apache.flex.compiler.tree.as.IReturnNode;
 import org.apache.flex.compiler.tree.as.ITypeNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;
 import org.apache.flex.compiler.visitor.IBlockWalker;
 
+import com.google.debugging.sourcemap.FilePosition;
+
 /**
  * @author Michael Schmalle
  */
@@ -64,6 +69,8 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     
     private SourceMapMapping lastMapping;
     
+    private Stack<String> nameStack = new Stack<String>();
+    
     private List<SourceMapMapping> sourceMapMappings;
     
     public List<SourceMapMapping> getSourceMapMappings()
@@ -174,6 +181,62 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     }
 
     @Override
+    public void emitLiteralContainer(ILiteralContainerNode node)
+    {
+        final IContainerNode cnode = node.getContentsNode();
+        final IContainerNode.ContainerType type = cnode.getContainerType();
+        String preFix = null;
+        String postFix = null;
+
+        if (type == IContainerNode.ContainerType.BRACES)
+        {
+            preFix = ASEmitterTokens.BLOCK_OPEN.getToken();
+            postFix = ASEmitterTokens.BLOCK_CLOSE.getToken();
+        }
+        else if (type == IContainerNode.ContainerType.BRACKETS)
+        {
+            preFix = ASEmitterTokens.SQUARE_OPEN.getToken();
+            postFix = ASEmitterTokens.SQUARE_CLOSE.getToken();
+        }
+        else if (type == IContainerNode.ContainerType.IMPLICIT)
+        {
+            // nothing to write, move along
+        }
+        else if (type == IContainerNode.ContainerType.PARENTHESIS)
+        {
+            preFix = ASEmitterTokens.PAREN_OPEN.getToken();
+            postFix = ASEmitterTokens.PAREN_CLOSE.getToken();
+        }
+
+        if (preFix != null)
+        {
+            startMapping(node);
+            write(preFix);
+            endMapping(node);
+        }
+
+        final int len = cnode.getChildCount();
+        for (int i = 0; i < len; i++)
+        {
+            IASNode child = cnode.getChild(i);
+            getWalker().walk(child);
+            if (i < len - 1)
+            {
+                startMapping(node);
+                writeToken(ASEmitterTokens.COMMA);
+                endMapping(node);
+            }
+        }
+
+        if (postFix != null)
+        {
+            startMapping(node);
+            write(postFix);
+            endMapping(node);
+        }
+    }
+
+    @Override
     public void emitReturn(IReturnNode node)
     {
         startMapping(node);
@@ -217,9 +280,53 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
             endMapping(keywordNode);
         }
     }
+
+    public void pushSourceMapName(ISourceLocation node)
+    {
+        boolean isValidMappingScope = node instanceof ITypeNode
+                || node instanceof IPackageNode
+                || node instanceof IFunctionNode;
+        if(!isValidMappingScope)
+        {
+            throw new IllegalStateException("A source mapping scope must be a package, type, or function.");
+        }
+        
+        IDefinitionNode definitionNode = (IDefinitionNode) node;
+        String nodeName = definitionNode.getQualifiedName();
+        ITypeDefinition typeDef = EmitterUtils.getTypeDefinition(definitionNode);
+        if (typeDef != null)
+        {
+            boolean isConstructor = node instanceof IFunctionNode &&
+                    ((IFunctionNode) node).isConstructor();
+            boolean isStatic = definitionNode.hasModifier(ASModifier.STATIC);
+            if (isConstructor)
+            {
+                nodeName = typeDef.getQualifiedName() + ".constructor";
+            }
+            else if (isStatic)
+            {
+                nodeName = typeDef.getQualifiedName() + "." + nodeName;
+            }
+            else
+            {
+                nodeName = typeDef.getQualifiedName() + ".prototype." + nodeName;
+            }
+        }
+        nameStack.push(nodeName);
+    }
     
+    public void popSourceMapName()
+    {
+        nameStack.pop();
+    }
+
     public void startMapping(ISourceLocation node)
     {
+        startMapping(node, 0);
+    }
+    
+    public void startMapping(ISourceLocation node, int startOffset)
+    {
         if (lastMapping != null)
         {
             FilePosition sourceStartPosition = lastMapping.sourceStartPosition;
@@ -246,37 +353,18 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
             }
             return;
         }
+        int sourceLine = node.getLine();
+        int sourceColumn = node.getColumn() + startOffset;
         
         String nodeName = null;
-        if (node instanceof IDefinitionNode)
+        if (nameStack.size() > 0)
         {
-            IDefinitionNode definitionNode = (IDefinitionNode) node; 
-            nodeName = definitionNode.getQualifiedName();
-
-            ITypeDefinition typeDef = EmitterUtils.getTypeDefinition(definitionNode);
-            if (typeDef != null)
-            {
-                boolean isConstructor = node instanceof IFunctionNode &&
-                        ((IFunctionNode) node).isConstructor();
-                boolean isStatic = definitionNode.hasModifier(ASModifier.STATIC);
-                if (isConstructor)
-                {
-                    nodeName = typeDef.getQualifiedName() + ".constructor";
-                }
-                else if (isStatic)
-                {
-                    nodeName = typeDef.getQualifiedName() + "." + nodeName;
-                }
-                else
-                {
-                    nodeName = typeDef.getQualifiedName() + ".prototype." + nodeName;
-                }
-            }
+            nodeName = nameStack.lastElement();
         }
         SourceMapMapping mapping = new SourceMapMapping();
         mapping.sourcePath = sourcePath;
         mapping.name = nodeName;
-        mapping.sourceStartPosition = new FilePosition(node.getLine(), node.getColumn());
+        mapping.sourceStartPosition = new FilePosition(sourceLine, sourceColumn);
         mapping.destStartPosition = new FilePosition(getCurrentLine(), getCurrentColumn());
         lastMapping = mapping;
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ad6f1d04/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 2f5775e..94e1d5e 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -643,9 +643,9 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
     // Specific
     //--------------------------------------------------------------------------
 
-    public void emitIsAs(IExpressionNode left, IExpressionNode right, ASTNodeID id, boolean coercion)
+    public void emitIsAs(IExpressionNode node, IExpressionNode left, IExpressionNode right, ASTNodeID id, boolean coercion)
     {
-        asIsEmitter.emitIsAs(left, right, id, coercion);
+        asIsEmitter.emitIsAs(node, left, right, id, coercion);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ad6f1d04/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
index 9f242ba..1557b7e 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
@@ -21,6 +21,7 @@ package org.apache.flex.compiler.internal.codegen.js.jx;
 
 import org.apache.flex.compiler.asdoc.flexjs.ASDocComment;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.definitions.IClassDefinition;
 import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
@@ -30,6 +31,8 @@ import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IContainerNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
 
@@ -41,8 +44,8 @@ public class AsIsEmitter extends JSSubEmitter
         super(emitter);
     }
 
-    public void emitIsAs(IExpressionNode left, IExpressionNode right,
-            ASTNodeID id, boolean coercion)
+    public void emitIsAs(IExpressionNode node, IExpressionNode left, IExpressionNode right,
+                         ASTNodeID id, boolean coercion)
     {
         // project is null in unit tests
         //IDefinition dnode = project != null ? (right).resolve(project) : null;
@@ -130,6 +133,15 @@ public class AsIsEmitter extends JSSubEmitter
         if (project instanceof FlexJSProject)
         	((FlexJSProject)project).needLanguage = true;
         
+        if (node instanceof IBinaryOperatorNode)
+        {
+            IBinaryOperatorNode binaryOperatorNode = (IBinaryOperatorNode) node; 
+            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode().getEnd() - binaryOperatorNode.getLeftOperandNode().getStart());
+        }
+        else
+        {
+            getEmitter().startMapping(node);
+        }
         write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
         write(ASEmitterTokens.MEMBER_ACCESS);
 
@@ -139,14 +151,41 @@ public class AsIsEmitter extends JSSubEmitter
             write(ASEmitterTokens.AS);
 
         write(ASEmitterTokens.PAREN_OPEN);
+        getEmitter().endMapping(node);
+        
         getWalker().walk(left);
+        if (node instanceof IBinaryOperatorNode)
+        {
+            IBinaryOperatorNode binaryOperatorNode = (IBinaryOperatorNode) node;
+            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode().getEnd() - binaryOperatorNode.getLeftOperandNode().getStart());
+        }
+        else
+        {
+            getEmitter().startMapping(node);
+        }
         writeToken(ASEmitterTokens.COMMA);
+        getEmitter().endMapping(node);
 
-        if (dnode instanceof ClassDefinition)
+        if (dnode instanceof IClassDefinition)
+        {
+            getEmitter().startMapping(right);
             write(getEmitter().formatQualifiedName(dnode.getQualifiedName()));
+            getEmitter().endMapping(right);
+        }
         else
+        {
             getWalker().walk(right);
+        }
 
+        if (node instanceof IBinaryOperatorNode)
+        {
+            IBinaryOperatorNode binaryOperatorNode = (IBinaryOperatorNode) node;
+            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode().getEnd() - binaryOperatorNode.getLeftOperandNode().getStart());
+        }
+        else
+        {
+            getEmitter().startMapping(node);
+        }
         if (coercion)
         {
             writeToken(ASEmitterTokens.COMMA);
@@ -154,6 +193,7 @@ public class AsIsEmitter extends JSSubEmitter
         }
 
         write(ASEmitterTokens.PAREN_CLOSE);
+        getEmitter().endMapping(node);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ad6f1d04/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
index e37f0e1..9ef9060 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
@@ -64,7 +64,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
         }
         else */if (id == ASTNodeID.Op_IsID || id == ASTNodeID.Op_AsID)
         {
-            fjs.emitIsAs(node.getLeftOperandNode(), node.getRightOperandNode(),
+            fjs.emitIsAs(node, node.getLeftOperandNode(), node.getRightOperandNode(),
                     id, false);
         }
         else if (id == ASTNodeID.Op_InstanceOfID)
@@ -328,6 +328,8 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
         {
             getWalker().walk(node.getLeftOperandNode());
 
+            getEmitter().startMapping(node, node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+            
             if (id != ASTNodeID.Op_CommaID)
                 write(ASEmitterTokens.SPACE);
 
@@ -349,6 +351,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
             }
 
             write(ASEmitterTokens.SPACE);
+            getEmitter().endMapping(node);
 
             /*
             IDefinition definition = node.getRightOperandNode().resolve(getProject());

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ad6f1d04/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java
index bd6289f..6bf01b7 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java
@@ -54,6 +54,8 @@ public class ClassEmitter extends JSSubEmitter implements
 
         // TODO (mschmalle) will remove this cast as more things get abstracted
         JSFlexJSEmitter fjs = (JSFlexJSEmitter) getEmitter();
+        
+        getEmitter().pushSourceMapName(node);
 
         ASDocComment asDoc = (ASDocComment) node.getASDocComment();
         if (asDoc != null && MXMLJSC.keepASDoc)
@@ -141,6 +143,8 @@ public class ClassEmitter extends JSSubEmitter implements
         fjs.getAccessorEmitter().emit(definition);
         
         fjs.getPackageFooterEmitter().emitClassInfo(node);
+
+        getEmitter().popSourceMapName();
         getModel().popClass();
     }
     

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ad6f1d04/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
index b22c41d..8e03b91 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
@@ -83,12 +83,12 @@ public class FieldEmitter extends JSSubEmitter implements
             
             if (definition == null)
                 definition = ndef.getContainingScope().getDefinition();
-            
+
+            getEmitter().startMapping(node.getNameExpressionNode());
             write(getEmitter().formatQualifiedName(definition.getQualifiedName())
                     + ASEmitterTokens.MEMBER_ACCESS.getToken() + root);
-            getEmitter().startMapping(node);
             write(node.getName());
-            getEmitter().endMapping(node);
+            getEmitter().endMapping(node.getNameExpressionNode());
         }
 
         if (node.getNodeID() == ASTNodeID.BindableVariableID)
@@ -101,8 +101,10 @@ public class FieldEmitter extends JSSubEmitter implements
         if (vnode != null &&
                 (ndef.isStatic() || EmitterUtils.isScalar(vnode) || isPackageOrFileMember))
         {
+            getEmitter().startMapping(node);
             write(ASEmitterTokens.SPACE);
             writeToken(ASEmitterTokens.EQUAL);
+            getEmitter().endMapping(node);
             getEmitter().getWalker().walk(vnode);
         }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ad6f1d04/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
index a71b4dd..5f590e1 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
@@ -163,9 +163,9 @@ public class FunctionCallEmitter extends JSSubEmitter implements ISubEmitter<IFu
                 fjs.walkArguments(node.getArgumentNodes());
                 write(ASEmitterTokens.PAREN_CLOSE);
             }
-            else
+            else //function-style cast
             {
-                fjs.emitIsAs(node.getArgumentNodes()[0], node.getNameNode(), ASTNodeID.Op_AsID, true);
+                fjs.emitIsAs(node, node.getArgumentNodes()[0], node.getNameNode(), ASTNodeID.Op_AsID, true);
             }
         }
         else

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ad6f1d04/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java
index 15d9fa7..e067bda 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java
@@ -74,6 +74,7 @@ public class MethodEmitter extends JSSubEmitter implements
         }
         else
         {
+            getEmitter().startMapping(node.getNameExpressionNode());
             ITypeDefinition typeDef = EmitterUtils.getTypeDefinition(node);
             if (typeDef != null)
             {
@@ -81,16 +82,8 @@ public class MethodEmitter extends JSSubEmitter implements
             }
             if (qname != null && !qname.equals(""))
             {
-                if (isConstructor)
-                {
-                    getEmitter().startMapping(node);
-                }
                 write(fjs.formatQualifiedName(qname));
-                if (isConstructor)
-                {
-                    getEmitter().endMapping(node);
-                }
-                else
+                if (!isConstructor)
                 {
                     write(ASEmitterTokens.MEMBER_ACCESS);
                     if (!fn.hasModifier(ASModifier.STATIC))
@@ -102,15 +95,16 @@ public class MethodEmitter extends JSSubEmitter implements
             }
             if (!isConstructor)
             {
-                getEmitter().startMapping(node);
                 fjs.emitMemberName(node);
-                getEmitter().endMapping(node);
             }
+            getEmitter().endMapping(node.getNameExpressionNode());
         }
 
+        getEmitter().startMapping(node);
         write(ASEmitterTokens.SPACE);
         writeToken(ASEmitterTokens.EQUAL);
         write(ASEmitterTokens.FUNCTION);
+        getEmitter().endMapping(node);
 
         fjs.emitParameters(node.getParameterNodes());
 
@@ -130,7 +124,11 @@ public class MethodEmitter extends JSSubEmitter implements
         }
 
         if (!isConstructor || node.getScopedNode().getChildCount() > 0)
+        {
+            getEmitter().pushSourceMapName(node);
             fjs.emitMethodScope(node.getScopedNode());
+            getEmitter().popSourceMapName();
+        }
 
         if (isConstructor && hasSuperClass)
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ad6f1d04/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java
index eab3413..e5aaf34 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageFooterEmitter.java
@@ -66,6 +66,7 @@ public class PackageFooterEmitter extends JSSubEmitter implements
     @Override
     public void emit(IPackageDefinition definition)
     {
+        getEmitter().popSourceMapName();
         IASScope containedScope = definition.getContainedScope();
         ITypeDefinition type = EmitterUtils.findType(containedScope
                 .getAllLocalDefinitions());

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ad6f1d04/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
index 64b560a..48acf5b 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
@@ -131,6 +131,8 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
     {
         // TODO (mschmalle) will remove this cast as more things get abstracted
         JSFlexJSEmitter fjs = (JSFlexJSEmitter) getEmitter();
+        
+        getEmitter().pushSourceMapName(definition.getNode());
 
         PackageScope containedScope = (PackageScope) definition
                 .getContainedScope();


[05/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - JSEmitter: source maps for if/else if/else, while, do-while, and unary operators

Posted by cd...@apache.org.
JSEmitter: source maps for if/else if/else, while, do-while, and unary operators


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

Branch: refs/heads/feature/maven-migration
Commit: 1aba54f6086fa4db29230e0b44ea0e2ef9a405fd
Parents: 2a40650
Author: Josh Tynjala <jo...@apache.org>
Authored: Tue Mar 29 15:45:43 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Tue Mar 29 15:45:43 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/JSEmitter.java | 157 +++++++++++++++++++
 1 file changed, 157 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1aba54f6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index d510230..cec48b9 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -36,6 +36,7 @@ import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
 import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IConditionalNode;
 import org.apache.flex.compiler.tree.as.IContainerNode;
 import org.apache.flex.compiler.tree.as.IDefinitionNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
@@ -49,9 +50,12 @@ import org.apache.flex.compiler.tree.as.IObjectLiteralValuePairNode;
 import org.apache.flex.compiler.tree.as.IPackageNode;
 import org.apache.flex.compiler.tree.as.IParameterNode;
 import org.apache.flex.compiler.tree.as.IReturnNode;
+import org.apache.flex.compiler.tree.as.ITerminalNode;
 import org.apache.flex.compiler.tree.as.ITypeNode;
 import org.apache.flex.compiler.tree.as.ITypedExpressionNode;
+import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;
+import org.apache.flex.compiler.tree.as.IWhileLoopNode;
 import org.apache.flex.compiler.visitor.IBlockWalker;
 
 import com.google.debugging.sourcemap.FilePosition;
@@ -318,6 +322,159 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         }
     }
 
+    @Override
+    public void emitConditional(IConditionalNode node, boolean isElseIf)
+    {
+        startMapping(node);
+        if (isElseIf)
+        {
+            writeToken(ASEmitterTokens.ELSE);
+        }
+        writeToken(ASEmitterTokens.IF);
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+        
+        IASNode conditionalExpression = node.getChild(0);
+        getWalker().walk(conditionalExpression);
+        
+        startMapping(node, conditionalExpression.getAbsoluteEnd() - node.getAbsoluteStart());
+        write(ASEmitterTokens.PAREN_CLOSE);
+        IContainerNode xnode = (IContainerNode) node.getStatementContentsNode();
+        if (!isImplicit(xnode))
+            write(ASEmitterTokens.SPACE);
+        endMapping(node);
+
+        getWalker().walk(node.getChild(1)); // BlockNode
+    }
+
+    @Override
+    public void emitElse(ITerminalNode node)
+    {
+        IContainerNode cnode = (IContainerNode) node.getChild(0);
+        
+        // if an implicit if, add a newline with no space
+        final boolean isImplicit = isImplicit(cnode);
+        if (isImplicit)
+            writeNewline();
+        else
+            write(ASEmitterTokens.SPACE);
+        
+        startMapping(node);
+        write(ASEmitterTokens.ELSE);
+        if (!isImplicit)
+            write(ASEmitterTokens.SPACE);
+        endMapping(node);
+
+        getWalker().walk(node); // TerminalNode
+    }
+
+    @Override
+    public void emitWhileLoop(IWhileLoopNode node)
+    {
+        IContainerNode cnode = (IContainerNode) node.getChild(1);
+        
+        startMapping(node);
+        writeToken(ASEmitterTokens.WHILE);
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+
+        IASNode conditionalExpression = node.getConditionalExpressionNode();
+        getWalker().walk(conditionalExpression);
+        
+        startMapping(node, conditionalExpression.getAbsoluteEnd() - node.getAbsoluteStart());
+        write(ASEmitterTokens.PAREN_CLOSE);
+        if (!isImplicit(cnode))
+            write(ASEmitterTokens.SPACE);
+        endMapping(node);
+        
+        getWalker().walk(node.getStatementContentsNode());
+    }
+
+    @Override
+    public void emitDoLoop(IWhileLoopNode node)
+    {
+        IContainerNode cnode = (IContainerNode) node.getChild(0);
+        
+        startMapping(node);
+        write(ASEmitterTokens.DO);
+        if (!isImplicit(cnode))
+            write(ASEmitterTokens.SPACE);
+        endMapping(node);
+
+        IASNode statementContents = node.getStatementContentsNode();
+        getWalker().walk(statementContents);
+        
+        startMapping(node, statementContents.getAbsoluteEnd() - statementContents.getAbsoluteStart());
+        if (!isImplicit(cnode))
+            write(ASEmitterTokens.SPACE);
+        else
+            writeNewline(); // TODO (mschmalle) there is something wrong here, block should NL
+        write(ASEmitterTokens.WHILE);
+        write(ASEmitterTokens.SPACE);
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+
+        IASNode conditionalExpression = node.getConditionalExpressionNode();
+        getWalker().walk(conditionalExpression);
+        
+        startMapping(node, conditionalExpression.getAbsoluteEnd() - node.getAbsoluteStart());
+        write(ASEmitterTokens.PAREN_CLOSE);
+        write(ASEmitterTokens.SEMICOLON);
+        endMapping(node);
+    }
+
+    @Override
+    public void emitPreUnaryOperator(IUnaryOperatorNode node)
+    {
+        startMapping(node);
+        write(node.getOperator().getOperatorText());
+        IExpressionNode opNode = node.getOperandNode();
+        endMapping(node);
+        getWalker().walk(opNode);
+    }
+
+    @Override
+    public void emitPostUnaryOperator(IUnaryOperatorNode node)
+    {
+        IExpressionNode operandNode = node.getOperandNode();
+        getWalker().walk(operandNode);
+        startMapping(node, operandNode.getAbsoluteEnd() - operandNode.getAbsoluteStart());
+        write(node.getOperator().getOperatorText());
+        endMapping(node);
+    }
+
+    @Override
+    public void emitDeleteOperator(IUnaryOperatorNode node)
+    {
+        startMapping(node);
+        writeToken(node.getOperator().getOperatorText());
+        endMapping(node);
+        getWalker().walk(node.getOperandNode());
+    }
+
+    @Override
+    public void emitVoidOperator(IUnaryOperatorNode node)
+    {
+        startMapping(node);
+        writeToken(node.getOperator().getOperatorText());
+        endMapping(node);
+        getWalker().walk(node.getOperandNode());
+    }
+
+    @Override
+    public void emitTypeOfOperator(IUnaryOperatorNode node)
+    {
+        startMapping(node);
+        write(node.getOperator().getOperatorText());
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+        IExpressionNode operandNode = node.getOperandNode();
+        getWalker().walk(operandNode);
+        startMapping(node);
+        write(ASEmitterTokens.PAREN_CLOSE);
+        endMapping(node);
+    }
+
     public void pushSourceMapName(ISourceLocation node)
     {
         boolean isValidMappingScope = node instanceof ITypeNode


[46/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - added source mapping for language identifiers

Posted by cd...@apache.org.
added source mapping for language identifiers


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

Branch: refs/heads/feature/maven-migration
Commit: 3bcbbffc8b2b4c6107b0a531ca8d81826140c44a
Parents: 4cc081b
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 8 17:00:08 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 8 17:00:08 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/JSEmitter.java | 11 +++++
 .../js/jx/LanguageIdentifierEmitter.java        | 44 ++++++++++++++++++++
 2 files changed, 55 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3bcbbffc/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index 2ab71b3..a50e288 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -36,6 +36,7 @@ import org.apache.flex.compiler.internal.codegen.js.jx.ForLoopEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.FunctionCallArgumentsEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.IfEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.IterationFlowEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.LanguageIdentifierEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.LiteralContainerEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.MemberKeywordEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.NumericLiteralEmitter;
@@ -59,6 +60,7 @@ import org.apache.flex.compiler.tree.as.IFunctionNode;
 import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
 import org.apache.flex.compiler.tree.as.IIfNode;
 import org.apache.flex.compiler.tree.as.IIterationFlowNode;
+import org.apache.flex.compiler.tree.as.ILanguageIdentifierNode;
 import org.apache.flex.compiler.tree.as.ILiteralContainerNode;
 import org.apache.flex.compiler.tree.as.INumericLiteralNode;
 import org.apache.flex.compiler.tree.as.IObjectLiteralValuePairNode;
@@ -97,6 +99,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     public ForLoopEmitter forLoopEmitter;
     public IterationFlowEmitter interationFlowEmitter;
     public StatementEmitter statementEmitter;
+    public LanguageIdentifierEmitter languageIdentifierEmitter;
     public SourceMapDirectiveEmitter sourceMapDirectiveEmitter;
     
     @Override
@@ -140,6 +143,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         forLoopEmitter = new ForLoopEmitter(this);
         interationFlowEmitter = new IterationFlowEmitter(this);
         statementEmitter = new StatementEmitter(this);
+        languageIdentifierEmitter = new LanguageIdentifierEmitter(this);
         sourceMapDirectiveEmitter = new SourceMapDirectiveEmitter(this);
     }
 
@@ -258,6 +262,13 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     {
         ternaryOperatorEmitter.emit(node);
     }
+
+    @Override
+    public void emitLanguageIdentifier(ILanguageIdentifierNode node)
+    {
+        languageIdentifierEmitter.emit(node);
+    }
+
     @Override
     public void emitStatement(IASNode node)
     {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3bcbbffc/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LanguageIdentifierEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LanguageIdentifierEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LanguageIdentifierEmitter.java
new file mode 100644
index 0000000..8f01b71
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LanguageIdentifierEmitter.java
@@ -0,0 +1,44 @@
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.common.ISourceLocation;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.ILanguageIdentifierNode;
+
+public class LanguageIdentifierEmitter extends JSSubEmitter implements
+        ISubEmitter<ILanguageIdentifierNode>
+{
+    public LanguageIdentifierEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(ILanguageIdentifierNode node)
+    {
+        startMapping((ISourceLocation) node);
+        if (node.getKind() == ILanguageIdentifierNode.LanguageIdentifierKind.ANY_TYPE)
+        {
+            write(ASEmitterTokens.ANY_TYPE);
+        }
+        else if (node.getKind() == ILanguageIdentifierNode.LanguageIdentifierKind.REST)
+        {
+            write(ASEmitterTokens.ELLIPSIS);
+        }
+        else if (node.getKind() == ILanguageIdentifierNode.LanguageIdentifierKind.SUPER)
+        {
+            write(ASEmitterTokens.SUPER);
+        }
+        else if (node.getKind() == ILanguageIdentifierNode.LanguageIdentifierKind.THIS)
+        {
+            write(ASEmitterTokens.THIS);
+        }
+        else if (node.getKind() == ILanguageIdentifierNode.LanguageIdentifierKind.VOID)
+        {
+            write(ASEmitterTokens.VOID);
+        }
+        endMapping((ISourceLocation) node);
+    }
+}


[34/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - IdentifierEmitter: added missing source map for certain types of identifier

Posted by cd...@apache.org.
IdentifierEmitter: added missing source map for certain types of identifier


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

Branch: refs/heads/feature/maven-migration
Commit: 40604f56b6c60ea986c2572bfec076244940553b
Parents: 3e5e4fe
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Apr 6 17:25:58 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Apr 6 17:25:58 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/jx/IdentifierEmitter.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/40604f56/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
index 69217c1..b8a9703 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
@@ -217,7 +217,7 @@ public class IdentifierEmitter extends JSSubEmitter implements
                     //member access expression, it shouldn't be fully qualified
                     needsFormattedName = parentMemberAccessNode.getLeftOperandNode() == node;
                 }
-                getEmitter().startMapping(node);
+                startMapping(node);
                 if (parentNodeId == ASTNodeID.MemberAccessExpressionID)
                 {
                     if (needsFormattedName)
@@ -235,10 +235,14 @@ public class IdentifierEmitter extends JSSubEmitter implements
                     write(getEmitter().formatQualifiedName(qname));
                 else
                     write(qname);
-                getEmitter().endMapping(node);
+                endMapping(node);
             }
             else
+            {
+                startMapping(node);
                 write(node.getName());
+                endMapping(node);
+            }
         }
     }
 


[18/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - compiler.jx: emitParameters() accepts the result of getParametersContainerNode() instead of getParameterNodes() so that the parentheses that are emitted match up with the AST node t

Posted by cd...@apache.org.
compiler.jx: emitParameters() accepts the result of getParametersContainerNode() instead of getParameterNodes() so that the parentheses that are emitted match up with the AST node that actually includes them (which will help with source maps)


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

Branch: refs/heads/feature/maven-migration
Commit: fd2f51c66c01b86c8d5cd4647cb35ebd511870ba
Parents: f31918b
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 1 10:49:09 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 1 10:49:09 2016 -0700

----------------------------------------------------------------------
 .../flex/compiler/internal/codegen/as/ASEmitter.java  | 14 +++++++-------
 .../flex/compiler/internal/codegen/js/JSEmitter.java  | 12 ++++++------
 .../internal/codegen/js/amd/JSAMDEmitter.java         |  6 +++---
 .../internal/codegen/js/goog/JSGoogEmitter.java       |  6 +++---
 .../internal/codegen/js/jx/AccessorEmitter.java       | 10 +++++-----
 .../codegen/js/jx/DefinePropertyFunctionEmitter.java  |  2 +-
 .../internal/codegen/js/jx/InterfaceEmitter.java      |  2 +-
 .../internal/codegen/js/jx/MethodEmitter.java         |  2 +-
 .../codegen/js/jx/ObjectDefinePropertyEmitter.java    |  4 ++--
 .../internal/codegen/js/vf2js/JSVF2JSEmitter.java     |  6 +++---
 10 files changed, 32 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd2f51c6/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 0a0daa3..53ce765 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
@@ -651,7 +651,7 @@ public class ASEmitter implements IASEmitter, IEmitter
         }
 
         emitMemberName(node);
-        emitParameters(node.getParameterNodes());
+        emitParameters(node.getParametersContainerNode());
         emitType(node.getReturnTypeNode());
         if (node.getParent().getParent().getNodeID() == ASTNodeID.ClassID)
         {
@@ -693,7 +693,7 @@ public class ASEmitter implements IASEmitter, IEmitter
         write(ASEmitterTokens.FUNCTION);
         write(ASEmitterTokens.SPACE);
         write(fnode.getName());
-        emitParameters(fnode.getParameterNodes());
+        emitParameters(fnode.getParametersContainerNode());
         emitType(fnode.getTypeNode());
         emitFunctionScope(fnode.getScopedNode());
     }
@@ -703,7 +703,7 @@ public class ASEmitter implements IASEmitter, IEmitter
     {
         FunctionNode fnode = node.getFunctionNode();
         write(ASEmitterTokens.FUNCTION);
-        emitParameters(fnode.getParameterNodes());
+        emitParameters(fnode.getParametersContainerNode());
         emitType(fnode.getTypeNode());
         emitFunctionScope(fnode.getScopedNode());
     }
@@ -772,14 +772,14 @@ public class ASEmitter implements IASEmitter, IEmitter
         getWalker().walk(node.getNameExpressionNode());
     }
 
-    public void emitParameters(IParameterNode[] nodes)
+    public void emitParameters(IContainerNode node)
     {
         write(ASEmitterTokens.PAREN_OPEN);
-        int len = nodes.length;
+        int len = node.getChildCount();
         for (int i = 0; i < len; i++)
         {
-            IParameterNode node = nodes[i];
-            getWalker().walk(node); //emitParameter
+            IParameterNode parameterNode = (IParameterNode) node.getChild(i);
+            getWalker().walk(parameterNode); //emitParameter
             if (i < len - 1)
             {
                 writeToken(ASEmitterTokens.COMMA);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd2f51c6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index 01a3298..bd7bf15 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -113,7 +113,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         write(ASEmitterTokens.SPACE);
         write(fnode.getName());
         endMapping(node);
-        emitParameters(fnode.getParameterNodes());
+        emitParameters(fnode.getParametersContainerNode());
         emitFunctionScope(fnode.getScopedNode());
     }
     
@@ -124,7 +124,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         FunctionNode fnode = node.getFunctionNode();
         write(ASEmitterTokens.FUNCTION);
         endMapping(node);
-        emitParameters(fnode.getParameterNodes());
+        emitParameters(fnode.getParametersContainerNode());
         emitFunctionScope(fnode.getScopedNode());
     }
 
@@ -160,14 +160,14 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         }
     }
 
-    public void emitParameters(IParameterNode[] nodes)
+    public void emitParameters(IContainerNode node)
     {
         write(ASEmitterTokens.PAREN_OPEN);
-        int len = nodes.length;
+        int len = node.getChildCount();
         for (int i = 0; i < len; i++)
         {
-            IParameterNode node = nodes[i];
-            getWalker().walk(node); //emitParameter
+            IParameterNode parameterNode = (IParameterNode) node.getChild(i);
+            getWalker().walk(parameterNode); //emitParameter
             if (i < len - 1)
             {
                 writeToken(ASEmitterTokens.COMMA);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd2f51c6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java
index 3f77efc..fe00d82 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java
@@ -186,7 +186,7 @@ public class JSAMDEmitter extends JSEmitter implements IJSAMDEmitter
 
         write("function ");
         write(node.getName());
-        emitParameters(node.getParameterNodes());
+        emitParameters(node.getParametersContainerNode());
         if (!isImplicit((IContainerNode) node.getScopedNode()))
         {
             emitMethodScope(node.getScopedNode());
@@ -604,7 +604,7 @@ public class JSAMDEmitter extends JSEmitter implements IJSAMDEmitter
 
         write(kind + ": function ");
         write(definition.getBaseName() + "$" + kind);
-        emitParameters(fnode.getParameterNodes());
+        emitParameters(fnode.getParametersContainerNode());
         emitMethodScope(fnode.getScopedNode());
     }
 
@@ -626,7 +626,7 @@ public class JSAMDEmitter extends JSEmitter implements IJSAMDEmitter
         write(":");
         write(" function ");
         write(node.getName());
-        emitParameters(node.getParameterNodes());
+        emitParameters(node.getParametersContainerNode());
         emitMethodScope(node.getScopedNode());
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd2f51c6/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 bc48f83..d37e258 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
@@ -334,7 +334,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
                     writeToken(ASEmitterTokens.EQUAL);
                     write(ASEmitterTokens.FUNCTION);
 
-                    emitParameters(((IFunctionNode) mnode).getParameterNodes());
+                    emitParameters(((IFunctionNode) mnode).getParametersContainerNode());
 
                     write(ASEmitterTokens.SPACE);
                     write(ASEmitterTokens.BLOCK_OPEN);
@@ -517,7 +517,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
         writeToken(ASEmitterTokens.EQUAL);
         write(ASEmitterTokens.FUNCTION);
 
-        emitParameters(node.getParameterNodes());
+        emitParameters(node.getParametersContainerNode());
 
         boolean hasSuperClass = EmitterUtils.hasSuperClass(project, node);
 
@@ -1003,7 +1003,7 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
                 : ASEmitterTokens.SET);
         write(ASEmitterTokens.COLON);
         write(ASEmitterTokens.FUNCTION);
-        emitParameters(node.getParameterNodes());
+        emitParameters(node.getParametersContainerNode());
 
         emitDefinePropertyFunction(node);
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd2f51c6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
index e958fe1..f2910d7 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AccessorEmitter.java
@@ -129,7 +129,7 @@ public class AccessorEmitter extends JSSubEmitter implements
                     write(JSDocEmitterTokens.JSDOC_CLOSE);
                     write(ASEmitterTokens.SPACE);
                     write(ASEmitterTokens.FUNCTION);
-                    fjs.emitParameters(p.getter.getParameterNodes());
+                    fjs.emitParameters(p.getter.getParametersContainerNode());
 
                     fjs.emitDefinePropertyFunction(p.getter);
                     wroteGetter = true;
@@ -207,7 +207,7 @@ public class AccessorEmitter extends JSSubEmitter implements
                     write(JSDocEmitterTokens.JSDOC_CLOSE);
                     write(ASEmitterTokens.SPACE);
                     write(ASEmitterTokens.FUNCTION);
-                    fjs.emitParameters(p.setter.getParameterNodes());
+                    fjs.emitParameters(p.setter.getParametersContainerNode());
 
                     fjs.emitDefinePropertyFunction(p.setter);
                 }
@@ -310,7 +310,7 @@ public class AccessorEmitter extends JSSubEmitter implements
                     write(ASEmitterTokens.COLON);
                     write(ASEmitterTokens.SPACE);
                     write(ASEmitterTokens.FUNCTION);
-                    fjs.emitParameters(p.getter.getParameterNodes());
+                    fjs.emitParameters(p.getter.getParametersContainerNode());
 
                     fjs.emitDefinePropertyFunction(p.getter);
                 }
@@ -323,7 +323,7 @@ public class AccessorEmitter extends JSSubEmitter implements
                     write(ASEmitterTokens.COLON);
                     write(ASEmitterTokens.SPACE);
                     write(ASEmitterTokens.FUNCTION);
-                    fjs.emitParameters(p.setter.getParameterNodes());
+                    fjs.emitParameters(p.setter.getParametersContainerNode());
 
                     fjs.emitDefinePropertyFunction(p.setter);
                 }
@@ -412,7 +412,7 @@ public class AccessorEmitter extends JSSubEmitter implements
             writeToken(node.getName());
             writeToken(ASEmitterTokens.EQUAL);
             write(ASEmitterTokens.FUNCTION);
-            fjs.emitParameters(node.getParameterNodes());
+            fjs.emitParameters(node.getParametersContainerNode());
             //writeNewline();
             fjs.emitMethodScope(node.getScopedNode());
         }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd2f51c6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DefinePropertyFunctionEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DefinePropertyFunctionEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DefinePropertyFunctionEmitter.java
index d1e69d7..f267cff 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DefinePropertyFunctionEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DefinePropertyFunctionEmitter.java
@@ -63,7 +63,7 @@ public class DefinePropertyFunctionEmitter extends JSSubEmitter implements
         if (isBindableSetter)
         {
             //write(ASEmitterTokens.FUNCTION);
-            //emitParameters(node.getParameterNodes());
+            //emitParameters(node.getParametersContainerNode());
             write(ASEmitterTokens.SPACE);
             writeNewline(ASEmitterTokens.BLOCK_OPEN);
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd2f51c6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
index a557d78..626896f 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/InterfaceEmitter.java
@@ -114,7 +114,7 @@ public class InterfaceEmitter extends JSSubEmitter implements
                     write(ASEmitterTokens.FUNCTION);
 
                     fjs.emitParameters(((IFunctionNode) mnode)
-                            .getParameterNodes());
+                            .getParametersContainerNode());
 
                     write(ASEmitterTokens.SPACE);
                     write(ASEmitterTokens.BLOCK_OPEN);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd2f51c6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java
index e067bda..ee2b499 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java
@@ -106,7 +106,7 @@ public class MethodEmitter extends JSSubEmitter implements
         write(ASEmitterTokens.FUNCTION);
         getEmitter().endMapping(node);
 
-        fjs.emitParameters(node.getParameterNodes());
+        fjs.emitParameters(node.getParametersContainerNode());
 
         boolean hasSuperClass = EmitterUtils.hasSuperClass(project, node);
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd2f51c6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectDefinePropertyEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectDefinePropertyEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectDefinePropertyEmitter.java
index 2a20f6a..d867332 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectDefinePropertyEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectDefinePropertyEmitter.java
@@ -93,7 +93,7 @@ public class ObjectDefinePropertyEmitter extends JSSubEmitter implements
             writeToken(node.getName());
             writeToken(ASEmitterTokens.EQUAL);
             write(ASEmitterTokens.FUNCTION);
-            fjs.emitParameters(node.getParameterNodes());
+            fjs.emitParameters(node.getParametersContainerNode());
             //writeNewline();
             fjs.emitMethodScope(node.getScopedNode());
         }
@@ -150,7 +150,7 @@ public class ObjectDefinePropertyEmitter extends JSSubEmitter implements
                 : ASEmitterTokens.SET);
         write(ASEmitterTokens.COLON);
         write(ASEmitterTokens.FUNCTION);
-        fjs.emitParameters(node.getParameterNodes());
+        fjs.emitParameters(node.getParametersContainerNode());
 
         fjs.emitDefinePropertyFunction(node);
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/fd2f51c6/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
index 0eb2a78..13bcbb3 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
@@ -250,7 +250,7 @@ public class JSVF2JSEmitter extends JSGoogEmitter implements IJSVF2JSEmitter
             write(ASEmitterTokens.SPACE);
             writeToken(ASEmitterTokens.EQUAL);
             write(ASEmitterTokens.FUNCTION);
-            emitParameters(((IFunctionNode) mnode).getParameterNodes());
+            emitParameters(((IFunctionNode) mnode).getParametersContainerNode());
             write(ASEmitterTokens.SPACE);
             write(ASEmitterTokens.BLOCK_OPEN);
             write(ASEmitterTokens.BLOCK_CLOSE);
@@ -547,7 +547,7 @@ public class JSVF2JSEmitter extends JSGoogEmitter implements IJSVF2JSEmitter
         writeToken(ASEmitterTokens.EQUAL);
         write(ASEmitterTokens.FUNCTION);
 
-        emitParameters(node.getParameterNodes());
+        emitParameters(node.getParametersContainerNode());
 
         boolean hasSuperClass = hasSuperClass(node);
 
@@ -1472,7 +1472,7 @@ public class JSVF2JSEmitter extends JSGoogEmitter implements IJSVF2JSEmitter
         writeToken(node.getName());
         writeToken(ASEmitterTokens.EQUAL);
         write(ASEmitterTokens.FUNCTION);
-        emitParameters(node.getParameterNodes());
+        emitParameters(node.getParametersContainerNode());
         //writeNewline();
         emitMethodScope(node.getScopedNode());
     }


[15/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - fixed source map for object and array literals now that all [] and {} are included in AST

Posted by cd...@apache.org.
fixed source map for object and array literals now that all [] and {} are included in AST


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

Branch: refs/heads/feature/maven-migration
Commit: 847dc159f4921c7ffb8e65f9786900ecbece8321
Parents: ea51f07
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Mar 30 16:33:23 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Mar 30 16:33:23 2016 -0700

----------------------------------------------------------------------
 .../org/apache/flex/compiler/internal/codegen/js/JSEmitter.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/847dc159/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index aae2cfd..e42056c 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -236,7 +236,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
                 //we're mapping the comma to the literal container, but we use
                 //the child line/column in case the comma is not on the same
                 //line as the opening { or [
-                startMapping(node, child.getLine(), child.getColumn() + child.getEnd() - child.getStart());
+                startMapping(node, child.getLine(), child.getColumn() + child.getAbsoluteEnd() - child.getAbsoluteStart());
                 writeToken(ASEmitterTokens.COMMA);
                 endMapping(node);
             }
@@ -244,7 +244,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
 
         if (postFix != null)
         {
-            startMapping(node, node.getAbsoluteEnd() - node.getAbsoluteStart());
+            startMapping(node, node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
             write(postFix);
             endMapping(node);
         }


[09/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - compiler.jx.tests: source map tests now include destination file positions, and added some more expressions to tests

Posted by cd...@apache.org.
compiler.jx.tests: source map tests now include destination file positions, and added some more expressions to tests


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

Branch: refs/heads/feature/maven-migration
Commit: de3679146286bb5a9daa7fba1f26790d9c90866c
Parents: 285ada9
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Mar 30 11:38:14 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Mar 30 11:38:14 2016 -0700

----------------------------------------------------------------------
 .../js/sourcemaps/TestSourceMapExpressions.java | 258 +++++++++++++++++--
 .../internal/test/SourceMapTestBase.java        |  27 +-
 2 files changed, 261 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/de367914/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
index 7615f25..7b06cc7 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
@@ -23,7 +23,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IBinaryOperatorNode node = getBinaryNode("a + b");
         asBlockWalker.visitBinaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
     }
 
     @Test
@@ -31,7 +31,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IBinaryOperatorNode node = getBinaryNode("a - b");
         asBlockWalker.visitBinaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
     }
 
     @Test
@@ -39,7 +39,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IBinaryOperatorNode node = getBinaryNode("a / b");
         asBlockWalker.visitBinaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
     }
 
     @Test
@@ -47,7 +47,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IBinaryOperatorNode node = getBinaryNode("a % b");
         asBlockWalker.visitBinaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
     }
 
     @Test
@@ -55,7 +55,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IBinaryOperatorNode node = getBinaryNode("a * b");
         asBlockWalker.visitBinaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
     }
 
     @Test
@@ -63,7 +63,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IUnaryOperatorNode node = getUnaryNode("a++");
         asBlockWalker.visitUnaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getOperandNode().getEnd() - node.getOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 3);
     }
 
     @Test
@@ -71,7 +71,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IUnaryOperatorNode node = getUnaryNode("++a");
         asBlockWalker.visitUnaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn());
+        assertMapping(node, 0, 0, 0, 0, 0, 2);
     }
 
     @Test
@@ -79,7 +79,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IUnaryOperatorNode node = getUnaryNode("a--");
         asBlockWalker.visitUnaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getOperandNode().getEnd() - node.getOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 3);
     }
 
     @Test
@@ -87,7 +87,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IUnaryOperatorNode node = getUnaryNode("--a");
         asBlockWalker.visitUnaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn());
+        assertMapping(node, 0, 0, 0, 0, 0, 2);
     }
 
     //----------------------------------
@@ -99,7 +99,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IBinaryOperatorNode node = getBinaryNode("a += b");
         asBlockWalker.visitBinaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
     }
 
     @Test
@@ -107,7 +107,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IBinaryOperatorNode node = getBinaryNode("a -= b");
         asBlockWalker.visitBinaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
     }
 
     @Test
@@ -115,7 +115,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IBinaryOperatorNode node = getBinaryNode("a /= b");
         asBlockWalker.visitBinaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
     }
 
     @Test
@@ -123,7 +123,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IBinaryOperatorNode node = getBinaryNode("a %= b");
         asBlockWalker.visitBinaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
     }
 
     @Test
@@ -131,7 +131,7 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IBinaryOperatorNode node = getBinaryNode("a *= b");
         asBlockWalker.visitBinaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
     }
 
     //----------------------------------
@@ -143,7 +143,235 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     {
         IBinaryOperatorNode node = getBinaryNode("a = b");
         asBlockWalker.visitBinaryOperator(node);
-        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    //----------------------------------
+    // Bitwise
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseAnd()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a & b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseLeftShift()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a << b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_BitwiseNot()
+    {
+        IUnaryOperatorNode node = getUnaryNode("~a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 1);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseOr()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a | b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseRightShift()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a >> b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseUnsignedRightShift()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a >>> b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 6);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseXOR()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a ^ b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    //----------------------------------
+    // Bitwise compound assignment
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseAndAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a &= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseLeftShiftAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a <<= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 6);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseOrAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a |= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseRightShiftAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a >>= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 6);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseUnsignedRightShiftAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a >>>= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 7);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_BitwiseXORAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a ^= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    //----------------------------------
+    // Comparison
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_Equal()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a == b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_GreaterThan()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a > b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_GreaterThanEqual()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a >= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_NotEqual()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a != b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_LessThan()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a < b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_LessThanEqual()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a <= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_StrictEqual()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a === b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 6);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_StrictNotEqual()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a !== b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 6);
+    }
+
+    //----------------------------------
+    // Logical
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_LogicalAnd()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a && b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_LogicalAndAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a &&= b");
+        asBlockWalker.visitBinaryOperator(node);
+        //a = a && b
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+        assertMapping(node, 0, 1, 0, 5, 0, 9);
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_LogicalNot()
+    {
+        IUnaryOperatorNode node = getUnaryNode("!a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 1);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_LogicalOr()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a || b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_LogicalOrAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a ||= b");
+        asBlockWalker.visitBinaryOperator(node);
+        //a = a || b
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+        assertMapping(node, 0, 1, 0, 5, 0, 9);
     }
 
     protected IBackend createBackend()

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/de367914/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
index f1c1c25..756674b 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
@@ -1,12 +1,12 @@
 package org.apache.flex.compiler.internal.test;
 
-import static org.junit.Assert.assertTrue;
-
 import java.util.List;
 
-import com.google.debugging.sourcemap.FilePosition;
-import org.apache.flex.compiler.codegen.as.IASEmitter;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.tree.as.IASNode;
+
+import com.google.debugging.sourcemap.FilePosition;
+import static org.junit.Assert.assertTrue;
 
 public class SourceMapTestBase extends ASTestBase
 {
@@ -20,20 +20,29 @@ public class SourceMapTestBase extends ASTestBase
         jsEmitter = (IJSEmitter) asEmitter;
     }
 
-    protected void assertMapping(int sourceStartLine, int sourceStartColumn)
+    protected void assertMapping(IASNode node, int nodeStartLine, int nodeStartColumn,
+        int outStartLine, int outStartColumn, int outEndLine, int outEndColumn)
     {
+        int sourceStartLine = nodeStartLine + node.getLine();
+        int sourceStartColumn = nodeStartColumn + node.getColumn();
         boolean foundMapping = false;
         List<IJSEmitter.SourceMapMapping> mappings = jsEmitter.getSourceMapMappings();
         for (IJSEmitter.SourceMapMapping mapping : mappings)
         {
-            FilePosition position = mapping.sourceStartPosition;
-            if(position.getLine() == sourceStartLine
-                    && position.getColumn() == sourceStartColumn)
+            FilePosition sourcePosition = mapping.sourceStartPosition;
+            FilePosition startPosition = mapping.destStartPosition;
+            FilePosition endPosition = mapping.destEndPosition;
+            if (sourcePosition.getLine() == sourceStartLine
+                    && sourcePosition.getColumn() == sourceStartColumn
+                    && startPosition.getLine() == outStartLine
+                    && startPosition.getColumn() == outStartColumn
+                    && endPosition.getLine() == outEndLine
+                    && endPosition.getColumn() == outEndColumn)
             {
                 foundMapping = true;
             }
         }
-        assertTrue(foundMapping);
+        assertTrue("Mapping not found for node " + node.toString(), foundMapping);
     }
     
 }


[03/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - ASEmitter: broke up some of the code for if/else if/else and operators into separate functions to make them easier to override

Posted by cd...@apache.org.
ASEmitter: broke up some of the code for if/else if/else and operators into separate functions to make them easier to override


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

Branch: refs/heads/feature/maven-migration
Commit: 5e8e9cb537957ba918484b3289b462c3e455334b
Parents: 109b56b
Author: Josh Tynjala <jo...@apache.org>
Authored: Tue Mar 29 15:22:02 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Tue Mar 29 15:22:02 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/as/ASEmitter.java | 124 ++++++++++++-------
 1 file changed, 78 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5e8e9cb5/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 47f633b..0a0daa3 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
@@ -878,19 +878,8 @@ public class ASEmitter implements IASEmitter, IEmitter
     public void emitIf(IIfNode node)
     {
         IConditionalNode conditional = (IConditionalNode) node.getChild(0);
+        emitConditional(conditional, false);
 
-        IContainerNode xnode = (IContainerNode) conditional
-                .getStatementContentsNode();
-
-        writeToken(ASEmitterTokens.IF);
-        //write(SPACE);
-        write(ASEmitterTokens.PAREN_OPEN);
-        getWalker().walk(conditional.getChild(0)); // conditional expression
-        write(ASEmitterTokens.PAREN_CLOSE);
-        if (!isImplicit(xnode))
-            write(ASEmitterTokens.SPACE);
-
-        getWalker().walk(conditional.getChild(1)); // BlockNode
         IConditionalNode[] nodes = node.getElseIfNodes();
         if (nodes.length > 0)
         {
@@ -906,34 +895,49 @@ public class ASEmitter implements IASEmitter, IEmitter
                 else
                     write(ASEmitterTokens.SPACE);
 
-                writeToken(ASEmitterTokens.ELSE);
-                writeToken(ASEmitterTokens.IF);
-                write(ASEmitterTokens.PAREN_OPEN);
-                getWalker().walk(enode.getChild(0));
-                write(ASEmitterTokens.PAREN_CLOSE);
-                if (!isImplicit)
-                    write(ASEmitterTokens.SPACE);
-
-                getWalker().walk(enode.getChild(1)); // ConditionalNode
+                emitConditional(enode, true);
             }
         }
 
         ITerminalNode elseNode = node.getElseNode();
         if (elseNode != null)
         {
-            IContainerNode cnode = (IContainerNode) elseNode.getChild(0);
-            // if an implicit if, add a newline with no space
-            final boolean isImplicit = isImplicit(cnode);
-            if (isImplicit)
-                writeNewline();
-            else
-                write(ASEmitterTokens.SPACE);
-            write(ASEmitterTokens.ELSE);
-            if (!isImplicit)
-                write(ASEmitterTokens.SPACE);
+            emitElse(elseNode);
+        }
+    }
 
-            getWalker().walk(elseNode); // TerminalNode
+    public void emitConditional(IConditionalNode node, boolean isElseIf)
+    {
+        IContainerNode xnode = (IContainerNode) node.getStatementContentsNode();
+
+        if (isElseIf)
+        {
+            writeToken(ASEmitterTokens.ELSE);
         }
+        writeToken(ASEmitterTokens.IF);
+        write(ASEmitterTokens.PAREN_OPEN);
+        getWalker().walk(node.getChild(0)); // conditional expression
+        write(ASEmitterTokens.PAREN_CLOSE);
+        if (!isImplicit(xnode))
+            write(ASEmitterTokens.SPACE);
+
+        getWalker().walk(node.getChild(1)); // BlockNode
+    }
+    
+    public void emitElse(ITerminalNode node)
+    {
+        IContainerNode cnode = (IContainerNode) node.getChild(0);
+        // if an implicit if, add a newline with no space
+        final boolean isImplicit = isImplicit(cnode);
+        if (isImplicit)
+            writeNewline();
+        else
+            write(ASEmitterTokens.SPACE);
+        write(ASEmitterTokens.ELSE);
+        if (!isImplicit)
+            write(ASEmitterTokens.SPACE);
+
+        getWalker().walk(node); // TerminalNode
     }
 
     @Override
@@ -1447,35 +1451,63 @@ public class ASEmitter implements IASEmitter, IEmitter
                 || node.getNodeID() == ASTNodeID.Op_SubtractID
                 || node.getNodeID() == ASTNodeID.Op_AddID)
         {
-            write(node.getOperator().getOperatorText());
-            IExpressionNode opNode = node.getOperandNode();
-            getWalker().walk(opNode);
+            emitPreUnaryOperator(node);
         }
-
         else if (node.getNodeID() == ASTNodeID.Op_PostIncrID
                 || node.getNodeID() == ASTNodeID.Op_PostDecrID)
         {
-            getWalker().walk(node.getOperandNode());
-            write(node.getOperator().getOperatorText());
+            emitPostUnaryOperator(node);
         }
-        else if (node.getNodeID() == ASTNodeID.Op_DeleteID
-                || node.getNodeID() == ASTNodeID.Op_VoidID)
+        else if (node.getNodeID() == ASTNodeID.Op_DeleteID)
         {
-            writeToken(node.getOperator().getOperatorText());
-            getWalker().walk(node.getOperandNode());
+            emitDeleteOperator(node);
+        }
+        else if (node.getNodeID() == ASTNodeID.Op_VoidID)
+        {
+            emitVoidOperator(node);
         }
         else if (node.getNodeID() == ASTNodeID.Op_TypeOfID)
         {
-            write(node.getOperator().getOperatorText());
-            write(ASEmitterTokens.PAREN_OPEN);
-            getWalker().walk(node.getOperandNode());
-            write(ASEmitterTokens.PAREN_CLOSE);
+            emitTypeOfOperator(node);
         }
 
         if (ASNodeUtils.hasParenClose(node))
             write(ASEmitterTokens.PAREN_CLOSE);
     }
 
+    public void emitPreUnaryOperator(IUnaryOperatorNode node)
+    {
+        write(node.getOperator().getOperatorText());
+        IExpressionNode opNode = node.getOperandNode();
+        getWalker().walk(opNode);
+    }
+
+    public void emitPostUnaryOperator(IUnaryOperatorNode node)
+    {
+        getWalker().walk(node.getOperandNode());
+        write(node.getOperator().getOperatorText());
+    }
+
+    public void emitDeleteOperator(IUnaryOperatorNode node)
+    {
+        writeToken(node.getOperator().getOperatorText());
+        getWalker().walk(node.getOperandNode());
+    }
+
+    public void emitVoidOperator(IUnaryOperatorNode node)
+    {
+        writeToken(node.getOperator().getOperatorText());
+        getWalker().walk(node.getOperandNode());
+    }
+    
+    public void emitTypeOfOperator(IUnaryOperatorNode node)
+    {
+        write(node.getOperator().getOperatorText());
+        write(ASEmitterTokens.PAREN_OPEN);
+        getWalker().walk(node.getOperandNode());
+        write(ASEmitterTokens.PAREN_CLOSE);
+    }
+
     @Override
     public void emitLanguageIdentifier(ILanguageIdentifierNode node)
     {


[22/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - merge develop, added insertArgumentBefore(), insertArgumentAfter(), and insertArgumentAt() in EmitterUtils to allow function call arguments to be expanded

Posted by cd...@apache.org.
merge develop, added insertArgumentBefore(), insertArgumentAfter(), and insertArgumentAt() in EmitterUtils to allow function call arguments to be expanded


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

Branch: refs/heads/feature/maven-migration
Commit: 2e464eef22c9824b6b6abb80f861fa26cc27696f
Parents: c381df3 bf746d0
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 1 13:10:22 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 1 13:10:22 2016 -0700

----------------------------------------------------------------------
 ApproveFalcon.xml                               |   9 +-
 .../codegen/externals/ExternalsTestUtils.java   |   3 +
 .../codegen/externals/TestExternJQuery.java     |   4 +-
 .../externals/TestExternalsJSCompile.java       |  16 +-
 .../js/flexjs/TestFlexJSFieldMembers.java       |   9 +
 .../js/flexjs/TestFlexJSGlobalClasses.java      |  18 ++
 .../codegen/js/flexjs/TestFlexJSProject.java    |  73 ++++++-
 .../codegen/js/goog/TestGoogProject.java        |   4 +-
 .../codegen/js/vf2js/TestVF2JSFile.java         |  14 +-
 .../mxml/flexjs/TestFlexJSMXMLApplication.java  | 204 ++++++++++++++++++-
 .../mxml/vf2js/TestVF2JSMXMLApplication.java    |   8 +-
 .../compiler/internal/test/FlexJSTestBase.java  |   6 +-
 .../flex/compiler/internal/test/TestBase.java   |  15 +-
 .../compiler/internal/test/VF2JSTestBase.java   |   8 +-
 .../flexjs/projects/bad_overrides/Test.as       |  43 ++++
 .../projects/bad_overrides/Test_result.js       |  94 +++++++++
 .../flexjs/projects/bad_overrides/classes/A.as  |  41 ++++
 .../projects/bad_overrides/classes/A_result.js  |  92 +++++++++
 .../flexjs/projects/bad_overrides/classes/B.as  |  25 +++
 .../projects/bad_overrides/classes/B_result.js  |  69 +++++++
 .../flexjs/projects/bad_overrides/classes/C.as  |  25 +++
 .../projects/bad_overrides/classes/C_result.js  |  69 +++++++
 .../projects/bad_overrides/interfaces/IA.as     |  28 +++
 .../bad_overrides/interfaces/IA_result.js       |  69 +++++++
 .../projects/bad_overrides/interfaces/IB.as     |  22 ++
 .../bad_overrides/interfaces/IB_result.js       |  62 ++++++
 .../projects/bad_overrides/interfaces/IC.as     |  22 ++
 .../bad_overrides/interfaces/IC_result.js       |  62 ++++++
 .../flexjs/projects/overrides/Test.as           |  43 ++++
 .../flexjs/projects/overrides/Test_result.js    |  94 +++++++++
 .../flexjs/projects/overrides/classes/A.as      |  41 ++++
 .../projects/overrides/classes/A_result.js      |  92 +++++++++
 .../flexjs/projects/overrides/classes/B.as      |  25 +++
 .../projects/overrides/classes/B_result.js      |  69 +++++++
 .../flexjs/projects/overrides/classes/C.as      |  25 +++
 .../projects/overrides/classes/C_result.js      |  74 +++++++
 .../flexjs/projects/overrides/interfaces/IA.as  |  28 +++
 .../projects/overrides/interfaces/IA_result.js  |  69 +++++++
 .../flexjs/projects/overrides/interfaces/IB.as  |  22 ++
 .../projects/overrides/interfaces/IB_result.js  |  62 ++++++
 .../flexjs/projects/overrides/interfaces/IC.as  |  22 ++
 .../projects/overrides/interfaces/IC_result.js  |  65 ++++++
 .../apache/flex/compiler/clients/COMPJSC.java   |   4 +-
 .../apache/flex/compiler/clients/EXTERNC.java   |  27 ++-
 .../flex/compiler/clients/FlexJSToolGroup.java  |   1 +
 .../internal/codegen/js/amd/JSAMDEmitter.java   |  18 +-
 .../codegen/js/flexjs/JSFlexJSEmitter.java      |  48 +----
 .../codegen/js/jx/FunctionCallEmitter.java      |  22 ++
 .../codegen/js/jx/MemberAccessEmitter.java      |   2 +-
 .../internal/codegen/js/utils/EmitterUtils.java |  80 ++++++++
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  |  38 +++-
 .../internal/projects/FlexJSProject.java        |   1 -
 compiler.tests/downloads.xml                    |  35 +++-
 .../org/apache/flex/utils/AntTestAdapter.java   |   2 +-
 .../org/apache/flex/utils/MavenTestAdapter.java |  80 +++++++-
 .../compiler/internal/mxml/MXMLDataTests.java   |   9 +-
 .../org/apache/flex/compiler/clients/ASC.java   |   9 +-
 .../flex/compiler/config/Configuration.java     |  18 ++
 .../codegen/UnknownTreePatternInputOutput.java  |   2 +-
 .../internal/config/TargetSettings.java         |   6 +
 .../definitions/FunctionDefinition.java         |   2 +-
 .../internal/projects/CompilerProject.java      |   5 +
 .../compiler/internal/projects/FlexProject.java |  13 ++
 .../compiler/projects/ICompilerProject.java     |   7 +
 .../flex/compiler/targets/ITargetSettings.java  |   6 +
 env-template.properties                         |   4 +
 externs/js/missing.js                           |  24 ++-
 67 files changed, 2179 insertions(+), 129 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2e464eef/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java
----------------------------------------------------------------------
diff --cc compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java
index 27f1079,3f77efc..fd19e42
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java
@@@ -41,12 -41,9 +41,11 @@@ import org.apache.flex.compiler.definit
  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;
++import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
  import org.apache.flex.compiler.internal.definitions.ClassTraitsDefinition;
- import org.apache.flex.compiler.internal.tree.as.ContainerNode;
  import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
  import org.apache.flex.compiler.internal.tree.as.FunctionNode;
 +import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
- import org.apache.flex.compiler.internal.tree.as.NodeBase;
  import org.apache.flex.compiler.problems.ICompilerProblem;
  import org.apache.flex.compiler.projects.ICompilerProject;
  import org.apache.flex.compiler.scopes.IASScope;
@@@ -784,32 -783,28 +783,21 @@@ public class JSAMDEmitter extends JSEmi
      }
  
      @Override
 -    public void walkArguments(IExpressionNode[] nodes)
 -    {
 -    }
 -
 -    protected void walkArguments(IFunctionCallNode node)
 +    public void emitArguments(IContainerNode node)
      {
 -        FunctionCallNode fnode = (FunctionCallNode) node;
 -        IExpressionNode[] nodes = node.getArgumentNodes();
 -        int len = nodes.length;
 +        IContainerNode newNode = node;
 +        FunctionCallNode fnode = (FunctionCallNode) node.getParent();
-         int len = node.getChildCount();
          if (TempTools.injectThisArgument(fnode, false))
          {
-             ContainerNode newArgs = new ContainerNode(len + 1);
-             newArgs.setSourcePath(node.getSourcePath());
-             newArgs.span(node);
-             newArgs.setParent((NodeBase) node.getParent());
 -            write("this");
 -            if (len > 0)
 -            {
 -                write(",");
 -                write(" ");
 -            }
 +            IdentifierNode thisNode = new IdentifierNode("this");
-             thisNode.setSourcePath(node.getSourcePath());
-             newArgs.addItem(thisNode);
-             for (int i = 0; i < len; i++)
-             {
-                 newArgs.addItem((NodeBase) node.getChild(i));
-             }
-             newNode = newArgs;
++            newNode = EmitterUtils.insertArgumentsBefore(node, thisNode);
          }
  
-         len = newNode.getChildCount();
++        int len = newNode.getChildCount();
 +        write(ASEmitterTokens.PAREN_OPEN);
          for (int i = 0; i < len; i++)
          {
 -            IExpressionNode inode = nodes[i];
 +            IExpressionNode inode = (IExpressionNode) newNode.getChild(i);
              if (inode.getNodeID() == ASTNodeID.IdentifierID)
              {
                  emitArgumentIdentifier((IIdentifierNode) inode);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2e464eef/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --cc compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 0eaf7c9,92a722a..c45a01c
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@@ -53,6 -53,6 +53,7 @@@ import org.apache.flex.compiler.interna
  import org.apache.flex.compiler.internal.codegen.js.jx.SelfReferenceEmitter;
  import org.apache.flex.compiler.internal.codegen.js.jx.SuperCallEmitter;
  import org.apache.flex.compiler.internal.codegen.js.jx.VarDeclarationEmitter;
++import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
  import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitter;
  import org.apache.flex.compiler.internal.definitions.AccessorDefinition;
  import org.apache.flex.compiler.internal.projects.FlexJSProject;
@@@ -549,14 -531,12 +550,14 @@@ public class JSFlexJSEmitter extends JS
      }
  
      @Override
 -    public void walkArguments(IExpressionNode[] nodes)
 +    public void emitArguments(IContainerNode node)
      {
-         ContainerNode newArgs = null;
 -    	if (nodes.length == 2)
++        IContainerNode newNode = node;
 +        int len = node.getChildCount();
 +    	if (len == 2)
      	{
              ICompilerProject project = getWalker().getProject();;
 -    		IFunctionCallNode fcNode = (IFunctionCallNode)(nodes[0].getParent().getParent());
 +    		IFunctionCallNode fcNode = (IFunctionCallNode) node.getParent();
      		IExpressionNode nameNode = fcNode.getNameNode();
              IDefinition def = nameNode.resolve(project);
          	if (def != null && def.getBaseName().equals("insertAt"))
@@@ -566,76 -546,45 +567,41 @@@
          		{
              		if (nameNode instanceof MemberAccessExpressionNode)
              		{
-                         newArgs = new ContainerNode(len + 1);
-                         newArgs.setSourcePath(node.getSourcePath());
-                         newArgs.span(node);
-                         newArgs.setParent((NodeBase) node.getParent());
-                         newArgs.addItem((NodeBase) node.getChild(0));
-                         NumericLiteralNode extraNode = new NumericLiteralNode("0");
-                         extraNode.setSourcePath(node.getSourcePath());
-                         newArgs.addItem(extraNode);
-                         newArgs.addItem((NodeBase) node.getChild(1));
 -            			IExpressionNode[] newArgs = new IExpressionNode[3];
 -            			newArgs[0] = nodes[0];
 -            			newArgs[2] = nodes[1];
 -            			newArgs[1] = new NumericLiteralNode("0");
 -            			nodes = newArgs;
++                        newNode = EmitterUtils.insertArgumentsAt(node, 1, new NumericLiteralNode("0"));
              		}
      			}
      		}
      	}
 -    	super.walkArguments(nodes);
 -    	if (nodes.length == 1)
 -    	{
 +        if (len == 1)
 +        {
              ICompilerProject project = getWalker().getProject();;
 -    		IFunctionCallNode fcNode = (IFunctionCallNode)(nodes[0].getParent().getParent());
 -    		IExpressionNode nameNode = fcNode.getNameNode();
 +            IFunctionCallNode fcNode = (IFunctionCallNode) node.getParent();
 +            IExpressionNode nameNode = fcNode.getNameNode();
              IDefinition def = nameNode.resolve(project);
 -        	if (def != null && def.getBaseName().equals("removeAt"))
 -        	{
 -        		if (def.getParent() != null &&
 -            		def.getParent().getQualifiedName().equals("Array"))
 -        		{
 -            		if (nameNode instanceof MemberAccessExpressionNode)
 -            		{
 -            			write(", 1");
 -            		}
 -    			}
 -    		}
 -        	else if (def != null && def.getBaseName().equals("parseInt"))
 -        	{
 -        		IDefinition parentDef = def.getParent();
 -        		if (parentDef == null)
 -        		{
 -            		if (nameNode instanceof IdentifierNode)
 -            		{
 -            			write(", 10");
 -            		}
 -    			}
 -    		}
 -    	}
 +            if (def != null && def.getBaseName().equals("removeAt"))
 +            {
 +                if (def.getParent() != null &&
 +                        def.getParent().getQualifiedName().equals("Array"))
 +                {
 +                    if (nameNode instanceof MemberAccessExpressionNode)
 +                    {
-                         newArgs = new ContainerNode(len + 1);
-                         newArgs.setSourcePath(node.getSourcePath());
-                         newArgs.span(node);
-                         newArgs.setParent((NodeBase) node.getParent());
-                         for (int i = 0; i < len; i++)
-                         {
-                             newArgs.addItem((NodeBase) node.getChild(i));
-                         }
-                         NumericLiteralNode extraNode = new NumericLiteralNode("1");
-                         extraNode.setSourcePath(node.getSourcePath());
-                         newArgs.addItem(extraNode);
++                        newNode = EmitterUtils.insertArgumentsAfter(node, new NumericLiteralNode("1"));
 +                    }
 +                }
 +            }
 +            else if (def != null && def.getBaseName().equals("parseInt"))
 +            {
 +                IDefinition parentDef = def.getParent();
 +                if (parentDef == null)
 +                {
 +                    if (nameNode instanceof IdentifierNode)
 +                    {
-                         newArgs = new ContainerNode(len + 1);
-                         newArgs.setSourcePath(node.getSourcePath());
-                         newArgs.span(node);
-                         newArgs.setParent((NodeBase) node.getParent());
-                         for (int i = 0; i < len; i++)
-                         {
-                             newArgs.addItem((NodeBase) node.getChild(i));
-                         }
-                         NumericLiteralNode extraNode = new NumericLiteralNode("10");
-                         extraNode.setSourcePath(node.getSourcePath());
-                         newArgs.addItem(extraNode);
++                        newNode = EmitterUtils.insertArgumentsAfter(node, new NumericLiteralNode("10"));
 +                    }
 +                }
 +            }
 +        }
-         if (newArgs != null)
-         {
-             super.emitArguments(newArgs);
-         }
-         else
-         {
-             super.emitArguments(node);
-         }
++        super.emitArguments(newNode);
      }
  
      @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2e464eef/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
----------------------------------------------------------------------
diff --cc compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
index 0b8df4e,475541e..ed55481
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
@@@ -28,6 -28,6 +28,7 @@@ import org.apache.flex.compiler.interna
  import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
  import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitter;
  import org.apache.flex.compiler.internal.codegen.js.flexjs.JSFlexJSEmitterTokens;
++import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
  import org.apache.flex.compiler.internal.definitions.AppliedVectorDefinition;
  import org.apache.flex.compiler.internal.definitions.ClassDefinition;
  import org.apache.flex.compiler.internal.definitions.InterfaceDefinition;
@@@ -37,6 -40,6 +41,7 @@@ import org.apache.flex.compiler.interna
  import org.apache.flex.compiler.projects.ICompilerProject;
  import org.apache.flex.compiler.tree.ASTNodeID;
  import org.apache.flex.compiler.tree.as.IASNode;
++import org.apache.flex.compiler.tree.as.IContainerNode;
  import org.apache.flex.compiler.tree.as.IExpressionNode;
  import org.apache.flex.compiler.tree.as.IFunctionCallNode;
  import org.apache.flex.compiler.utils.NativeUtils;
@@@ -144,21 -141,30 +149,38 @@@ public class FunctionCallEmitter extend
                          write(ASEmitterTokens.MEMBER_ACCESS);
                          if (isInt)
                              write(JSFlexJSEmitterTokens.UNDERSCORE);
 +                        getEmitter().endMapping(node.getNameNode());
                      }
+                     else if (def != null && def.getBaseName().equals("sortOn"))
+                 	{
+                 		if (def.getParent() != null &&
+                     		def.getParent().getQualifiedName().equals("Array"))
+                 		{
+                             ICompilerProject project = this.getProject();
+                             if (project instanceof FlexJSProject)
+                                 ((FlexJSProject) project).needLanguage = true;
+                             write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
+                             write(ASEmitterTokens.MEMBER_ACCESS);
+                             write("sortOn");
 -                            write(ASEmitterTokens.PAREN_OPEN);
 -                            write(((IdentifierNode)cnode).getName());  // will this always be an indentifer node
 -                            writeToken(ASEmitterTokens.COMMA);
 -                            fjs.walkArguments(node.getArgumentNodes());
 -                            write(ASEmitterTokens.PAREN_CLOSE);
++                            IContainerNode newArgs = EmitterUtils.insertArgumentsBefore(node.getArgumentsNode(), cnode);
++                            fjs.emitArguments(newArgs);
+                             return;
+             			}
+             		}
+ 
                      else if (def instanceof AppliedVectorDefinition)
                      {
 -                        fjs.walkArguments(node.getArgumentNodes());
 +                        IExpressionNode[] argumentNodes = node.getArgumentNodes();
 +                        int len = argumentNodes.length;
 +                        for (int i = 0; i < len; i++)
 +                        {
 +                            IExpressionNode argumentNode = argumentNodes[i];
 +                            getWalker().walk(argumentNode);
 +                            if(i < len - 1)
 +                            {
 +                                write(", ");
 +                            }
 +                        }
                          write(".slice()");
                          return;
                      }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2e464eef/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2e464eef/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
----------------------------------------------------------------------
diff --cc compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
index 471e5b7,471e5b7..3e59a8d
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
@@@ -44,11 -44,11 +44,15 @@@ import org.apache.flex.compiler.interna
  import org.apache.flex.compiler.internal.definitions.VariableDefinition;
  import org.apache.flex.compiler.internal.projects.CompilerProject;
  import org.apache.flex.compiler.internal.scopes.TypeScope;
++import org.apache.flex.compiler.internal.tree.as.ContainerNode;
++import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
++import org.apache.flex.compiler.internal.tree.as.NodeBase;
  import org.apache.flex.compiler.internal.tree.as.ParameterNode;
  import org.apache.flex.compiler.projects.ICompilerProject;
  import org.apache.flex.compiler.tree.ASTNodeID;
  import org.apache.flex.compiler.tree.as.IASNode;
  import org.apache.flex.compiler.tree.as.IClassNode;
++import org.apache.flex.compiler.tree.as.IContainerNode;
  import org.apache.flex.compiler.tree.as.IDefinitionNode;
  import org.apache.flex.compiler.tree.as.IExpressionNode;
  import org.apache.flex.compiler.tree.as.IFunctionNode;
@@@ -425,4 -425,4 +429,80 @@@ public class EmitterUtil
          return false;
      }
  
++    public static IContainerNode insertArgumentsBefore(IContainerNode argumentsNode, IASNode... nodes)
++    {
++        int originalLength = argumentsNode.getChildCount();
++        int extraLength = nodes.length;
++        ContainerNode result = new ContainerNode(originalLength + extraLength);
++        result.setSourcePath(argumentsNode.getSourcePath());
++        result.span(argumentsNode);
++        result.setParent((NodeBase) argumentsNode.getParent());
++        for (int i = 0; i < extraLength; i++)
++        {
++            NodeBase node = (NodeBase) nodes[i];
++            node.setSourcePath(argumentsNode.getSourcePath());
++            result.addItem(node);
++        }
++        for (int i = 0; i < originalLength; i++)
++        {
++            result.addItem((NodeBase) argumentsNode.getChild(i));
++        }
++        return result;
++    }
++
++    public static IContainerNode insertArgumentsAfter(IContainerNode argumentsNode, IASNode... nodes)
++    {
++        int originalLength = argumentsNode.getChildCount();
++        int extraLength = nodes.length;
++        ContainerNode result = new ContainerNode(originalLength + extraLength);
++        result.setSourcePath(argumentsNode.getSourcePath());
++        result.span(argumentsNode);
++        result.setParent((NodeBase) argumentsNode.getParent());
++        for (int i = 0; i < originalLength; i++)
++        {
++            result.addItem((NodeBase) argumentsNode.getChild(i));
++        }
++        for (int i = 0; i < extraLength; i++)
++        {
++            NodeBase node = (NodeBase) nodes[i];
++            node.setSourcePath(argumentsNode.getSourcePath());
++            result.addItem(node);
++        }
++        return result;
++    }
++
++    public static IContainerNode insertArgumentsAt(IContainerNode argumentsNode, int index, IASNode... nodes)
++    {
++        int originalLength = argumentsNode.getChildCount();
++        int extraLength = nodes.length;
++        ContainerNode result = new ContainerNode(originalLength + extraLength);
++        result.setSourcePath(argumentsNode.getSourcePath());
++        result.span(argumentsNode);
++        result.setParent((NodeBase) argumentsNode.getParent());
++        for (int i = 0; i < originalLength; i++)
++        {
++            if(i < originalLength)
++            {
++                result.addItem((NodeBase) argumentsNode.getChild(i));
++            }
++            else
++            {
++                int j = i;
++                if (i >= index + extraLength)
++                {
++                    j -= extraLength;
++                    result.addItem((NodeBase) argumentsNode.getChild(j));
++                }
++                else
++                {
++                    j -= originalLength;
++                    NodeBase node = (NodeBase) nodes[j];
++                    node.setSourcePath(argumentsNode.getSourcePath());
++                    result.addItem(node);
++                }
++            }
++        }
++        return result;
++    }
++
  }


[31/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - Merge branch 'develop' into sourcemaps

Posted by cd...@apache.org.
Merge branch 'develop' into sourcemaps


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

Branch: refs/heads/feature/maven-migration
Commit: 6613895d1b2aae6bab0c520c1be243e40f04474b
Parents: c3b8a2b 0c394f1
Author: Josh Tynjala <jo...@apache.org>
Authored: Tue Apr 5 16:36:16 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Tue Apr 5 16:36:16 2016 -0700

----------------------------------------------------------------------
 build.properties     | 2 +-
 releasecandidate.xml | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



[47/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - add XML require to MXML files as well

Posted by cd...@apache.org.
add XML require to MXML files as well


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

Branch: refs/heads/feature/maven-migration
Commit: c054eae5ae416cd8e6675dc88cd255a9a47f8029
Parents: 3bcbbff
Author: Alex Harui <ah...@apache.org>
Authored: Sat Apr 9 23:42:25 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sat Apr 9 23:43:43 2016 -0700

----------------------------------------------------------------------
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c054eae5/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index a3dfac8..dde558f 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -36,6 +36,7 @@ import org.apache.flex.abc.semantics.Namespace;
 import org.apache.flex.compiler.codegen.as.IASEmitter;
 import org.apache.flex.compiler.codegen.mxml.flexjs.IMXMLFlexJSEmitter;
 import org.apache.flex.compiler.constants.IASKeywordConstants;
+import org.apache.flex.compiler.constants.IASLanguageConstants;
 import org.apache.flex.compiler.definitions.IClassDefinition;
 import org.apache.flex.compiler.definitions.IDefinition;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
@@ -157,6 +158,7 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
         IASEmitter asEmitter = ((IMXMLBlockWalker) getMXMLWalker()).getASEmitter();
         usedNames.addAll(((JSFlexJSEmitter)asEmitter).usedNames);
         
+        boolean foundXML = false;
     	String[] lines = output.split("\n");
     	ArrayList<String> finalLines = new ArrayList<String>();
     	boolean sawRequires = false;
@@ -170,6 +172,10 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 	            {
 	                int c2 = line.indexOf(")");
 	                String s = line.substring(c + 14, c2 - 1);
+                    if (s.equals(IASLanguageConstants.XML))
+                    {
+                        foundXML = true;
+                    }
 	    			sawRequires = true;
 	    			if (!usedNames.contains(s))
 	    				continue;
@@ -179,6 +185,20 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     		}
     		finalLines.add(line);
     	}
+        boolean needXML = ((FlexJSProject)(((IMXMLBlockWalker) getMXMLWalker()).getProject())).needXML;
+        if (needXML && !foundXML)
+        {
+            StringBuilder appendString = new StringBuilder();
+            appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+            appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
+            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+            appendString.append(IASLanguageConstants.XML);
+            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+            appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
+            appendString.append(ASEmitterTokens.SEMICOLON.getToken());
+            finalLines.add(appendString.toString());
+            // TODO (aharui) addLineToMappings(finalLines.size());
+        }
     	return Joiner.on("\n").join(finalLines);
     }
     


[40/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - ASParser.g: fixed issue where the parameters container of a FunctionNode had the wrong column position. similar to function call arguments, the parameters now include the parenthese

Posted by cd...@apache.org.
ASParser.g: fixed issue where the parameters container of a FunctionNode had the wrong column position. similar to function call arguments, the parameters now include the parentheses


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

Branch: refs/heads/feature/maven-migration
Commit: 94987360cb06b00d6f7909ffdfc2ab74f50de544
Parents: 239f935
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 8 10:48:33 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 8 10:48:33 2016 -0700

----------------------------------------------------------------------
 .../org/apache/flex/compiler/internal/parsing/as/ASParser.g  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/94987360/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g b/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
index 835f63a..34cb240 100644
--- a/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
+++ b/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
@@ -931,11 +931,11 @@ functionExpression returns [FunctionObjectNode n]
     	lpT:TOKEN_PAREN_OPEN
 		{
 			p = f.getParametersContainerNode();
-			p.startAfter(lpT);
+			p.startBefore(lpT);
 		}
     	formalParameters[p]
     	rpT:TOKEN_PAREN_CLOSE
- 		{ p.endBefore(rpT); }
+ 		{ p.endAfter(rpT); }
     	(resultType[f])?
      	{ enableSemicolonInsertion(); }	
 
@@ -1044,11 +1044,11 @@ functionDefinition[ContainerNode c, INamespaceDecorationNode namespace, List<Mod
 		lpT:TOKEN_PAREN_OPEN
 		{
 			final ContainerNode parameters = n.getParametersContainerNode();
-			parameters.startAfter(lpT);
+			parameters.startBefore(lpT);
  		}
      	formalParameters[parameters]	
      	(	rpT:TOKEN_PAREN_CLOSE 
-     		{ parameters.endBefore(rpT); }
+     		{ parameters.endAfter(rpT); }
      		// error recovery for typing in-progress function definitions
      		exception catch [RecognitionException ex] { handleParsingError(ex); }
      	)


[02/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - cleaned up some parts of the source map to include things like commas and parentheses, moved assignment operator out of assigned value because it's not in the source location of tha

Posted by cd...@apache.org.
cleaned up some parts of the source map to include things like commas and parentheses, moved assignment operator out of assigned value because it's not in the source location of that node, but before it (and that made it possible to source map it)


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

Branch: refs/heads/feature/maven-migration
Commit: 109b56b894ac8572dbb1e4251641a7f87b9df065
Parents: ad6f1d0
Author: Josh Tynjala <jo...@apache.org>
Authored: Sat Mar 26 17:36:48 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Sat Mar 26 17:36:48 2016 -0700

----------------------------------------------------------------------
 .../codegen/js/goog/TestGoogGlobalClasses.java  |  2 +-
 .../js/goog/TestGoogGlobalFunctions.java        |  2 +-
 .../compiler/internal/codegen/as/ASEmitter.java | 25 +++++--
 .../compiler/internal/codegen/js/JSEmitter.java | 49 ++++++++++++--
 .../internal/codegen/js/JSEmitterTokens.java    |  3 +-
 .../codegen/js/flexjs/JSFlexJSEmitter.java      |  7 --
 .../internal/codegen/js/goog/JSGoogEmitter.java | 70 +++++++++-----------
 .../codegen/js/jx/FunctionCallEmitter.java      |  6 +-
 .../codegen/js/jx/VarDeclarationEmitter.java    |  8 ++-
 .../codegen/js/vf2js/JSVF2JSEmitter.java        |  6 +-
 10 files changed, 114 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/109b56b8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogGlobalClasses.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogGlobalClasses.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogGlobalClasses.java
index 1bbdf55..fc9e523 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogGlobalClasses.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogGlobalClasses.java
@@ -271,7 +271,7 @@ public class TestGoogGlobalClasses extends TestGlobalClasses
     {
         IVariableNode node = getVariable("var a:Vector.<String> = new Vector.<String>(['Hello', 'World']);");
         asBlockWalker.visitVariable(node);
-        assertOut("var /** @type {Vector.<string>} */ a = new Vector(['Hello', 'World'])");
+        assertOut("var /** @type {Vector.<string>} */ a = new Array(['Hello', 'World'])");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/109b56b8/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogGlobalFunctions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogGlobalFunctions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogGlobalFunctions.java
index 79acf92..614edd5 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogGlobalFunctions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/goog/TestGoogGlobalFunctions.java
@@ -209,7 +209,7 @@ public class TestGoogGlobalFunctions extends TestGlobalFunctions
     {
         IVariableNode node = getVariable("var a:Vector.<String> = Vector.<String>(['Hello', 'World']);");
         asBlockWalker.visitVariable(node);
-        assertOut("var /** @type {Vector.<string>} */ a = Vector(['Hello', 'World'])");
+        assertOut("var /** @type {Vector.<string>} */ a = Array(['Hello', 'World'])");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/109b56b8/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 14ae6c5..47f633b 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
@@ -523,7 +523,14 @@ public class ASEmitter implements IASEmitter, IEmitter
 
         emitDeclarationName(node);
         emitType(node.getVariableTypeNode());
-        emitAssignedValue(node.getAssignedValueNode());
+        
+        IExpressionNode avnode = node.getAssignedValueNode();
+        if (avnode != null)
+        {
+            write(ASEmitterTokens.SPACE);
+            writeToken(ASEmitterTokens.EQUAL);
+            emitAssignedValue(avnode);
+        }
 
         if (!(node instanceof ChainedVariableNode))
         {
@@ -570,7 +577,14 @@ public class ASEmitter implements IASEmitter, IEmitter
 
         emitMemberName(node);
         emitType(node.getVariableTypeNode());
-        emitAssignedValue(node.getAssignedValueNode());
+
+        IExpressionNode avnode = node.getAssignedValueNode();
+        if (avnode != null)
+        {
+            write(ASEmitterTokens.SPACE);
+            writeToken(ASEmitterTokens.EQUAL);
+            emitAssignedValue(avnode);
+        }
 
         if (!(node instanceof ChainedVariableNode))
         {
@@ -810,12 +824,11 @@ public class ASEmitter implements IASEmitter, IEmitter
 
     protected void emitAssignedValue(IExpressionNode node)
     {
-        if (node != null)
+        if (node == null)
         {
-            write(ASEmitterTokens.SPACE);
-            writeToken(ASEmitterTokens.EQUAL);
-            getWalker().walk(node);
+            return;
         }
+        getWalker().walk(node);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/109b56b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index c830f73..d510230 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -33,7 +33,6 @@ import org.apache.flex.compiler.internal.codegen.as.ASEmitter;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
-import org.apache.flex.compiler.internal.tree.as.ContainerNode;
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
 import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
@@ -44,11 +43,14 @@ import org.apache.flex.compiler.tree.as.IFunctionNode;
 import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
 import org.apache.flex.compiler.tree.as.IKeywordNode;
 import org.apache.flex.compiler.tree.as.ILiteralContainerNode;
+import org.apache.flex.compiler.tree.as.ILiteralNode;
 import org.apache.flex.compiler.tree.as.INumericLiteralNode;
+import org.apache.flex.compiler.tree.as.IObjectLiteralValuePairNode;
 import org.apache.flex.compiler.tree.as.IPackageNode;
 import org.apache.flex.compiler.tree.as.IParameterNode;
 import org.apache.flex.compiler.tree.as.IReturnNode;
 import org.apache.flex.compiler.tree.as.ITypeNode;
+import org.apache.flex.compiler.tree.as.ITypedExpressionNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;
 import org.apache.flex.compiler.visitor.IBlockWalker;
 
@@ -222,7 +224,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
             getWalker().walk(child);
             if (i < len - 1)
             {
-                startMapping(node);
+                startMapping(node, child.getAbsoluteEnd() - node.getAbsoluteStart() + 1);
                 writeToken(ASEmitterTokens.COMMA);
                 endMapping(node);
             }
@@ -230,27 +232,62 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
 
         if (postFix != null)
         {
-            startMapping(node);
+            startMapping(node, node.getAbsoluteEnd() - node.getAbsoluteStart());
             write(postFix);
             endMapping(node);
         }
     }
 
     @Override
+    public void emitObjectLiteralValuePair(IObjectLiteralValuePairNode node)
+    {
+        ISourceLocation sourceLocationNode = (ISourceLocation) node;
+        
+        IExpressionNode nameNode = node.getNameNode();
+        if (!(nameNode instanceof ILiteralNode))
+        {
+            startMapping(nameNode);
+        }
+        getWalker().walk(node.getNameNode());
+        if (!(nameNode instanceof ILiteralNode))
+        {
+            endMapping(nameNode);
+        }
+        
+        startMapping(sourceLocationNode, nameNode.getAbsoluteEnd() - sourceLocationNode.getAbsoluteStart());
+        write(ASEmitterTokens.COLON);
+        endMapping(sourceLocationNode);
+        
+        getWalker().walk(node.getValueNode());
+    }
+
+    @Override
     public void emitReturn(IReturnNode node)
     {
+        IExpressionNode rnode = node.getReturnValueNode();
+        boolean hasReturnValue = rnode != null && rnode.getNodeID() != ASTNodeID.NilID;
+        
         startMapping(node);
         write(ASEmitterTokens.RETURN);
-        endMapping(node);
-        IExpressionNode rnode = node.getReturnValueNode();
-        if (rnode != null && rnode.getNodeID() != ASTNodeID.NilID)
+        if (hasReturnValue)
         {
             write(ASEmitterTokens.SPACE);
+        }
+        endMapping(node);
+        
+        if (hasReturnValue)
+        {
             getWalker().walk(rnode);
         }
     }
 
     @Override
+    public void emitTypedExpression(ITypedExpressionNode node)
+    {
+        write(JSEmitterTokens.ARRAY);
+    }
+
+    @Override
     public void emitMemberKeyword(IDefinitionNode node)
     {
         IKeywordNode keywordNode = null;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/109b56b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitterTokens.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitterTokens.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitterTokens.java
index ab8d079..82935af 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitterTokens.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitterTokens.java
@@ -30,7 +30,8 @@ public enum JSEmitterTokens implements IEmitterTokens
     DEFINE_PROPERTIES("defineProperties"),
     INTERFACE("interface"),
     PROTOTYPE("prototype"),
-    SLICE("slice");
+    SLICE("slice"),
+    ARRAY("Array");
 
     private String token;
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/109b56b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 94e1d5e..355250f 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -87,7 +87,6 @@ import org.apache.flex.compiler.tree.as.INamespaceNode;
 import org.apache.flex.compiler.tree.as.IPackageNode;
 import org.apache.flex.compiler.tree.as.IScopedNode;
 import org.apache.flex.compiler.tree.as.ISetterNode;
-import org.apache.flex.compiler.tree.as.ITypedExpressionNode;
 import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;
 import org.apache.flex.compiler.utils.ASNodeUtils;
@@ -622,12 +621,6 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
     }
 
     @Override
-    public void emitTypedExpression(ITypedExpressionNode node)
-    {
-        write(JSGoogEmitterTokens.ARRAY);
-    }
-
-    @Override
     public void emitIdentifier(IIdentifierNode node)
     {
         identifierEmitter.emit(node);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/109b56b8/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 6e7d555..bc48f83 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
@@ -70,7 +70,6 @@ import org.apache.flex.compiler.tree.as.INamespaceAccessExpressionNode;
 import org.apache.flex.compiler.tree.as.IParameterNode;
 import org.apache.flex.compiler.tree.as.ISetterNode;
 import org.apache.flex.compiler.tree.as.ITypeNode;
-import org.apache.flex.compiler.tree.as.ITypedExpressionNode;
 import org.apache.flex.compiler.tree.as.IVariableExpressionNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;
 import org.apache.flex.compiler.utils.ASNodeUtils;
@@ -422,8 +421,12 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
         }
 
         emitDeclarationName(node);
-        if (!(avnode instanceof IEmbedNode))
+        if (avnode != null && !(avnode instanceof IEmbedNode))
+        {
+            write(ASEmitterTokens.SPACE);
+            writeToken(ASEmitterTokens.EQUAL);
             emitAssignedValue(avnode);
+        }
 
         if (!(node instanceof ChainedVariableNode))
         {
@@ -881,49 +884,42 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
     @Override
     public void emitAssignedValue(IExpressionNode node)
     {
-        if (node != null)
+        if (node == null)
         {
-            write(ASEmitterTokens.SPACE);
-            writeToken(ASEmitterTokens.EQUAL);
-            IDefinition definition = node.resolve(getWalker().getProject());
-            if (node.getNodeID() == ASTNodeID.ClassReferenceID)
+            return;
+        }
+        IDefinition definition = node.resolve(getWalker().getProject());
+        if (node.getNodeID() == ASTNodeID.ClassReferenceID)
+        {
+            write(definition.getQualifiedName());
+        }
+        else
+        {
+            // AJH need Language.bind here and maybe not require
+            // that the node is a MemberAccessExpression
+            if (definition instanceof FunctionDefinition &&
+                    !((FunctionDefinition)definition).isStatic() &&
+                    (!(definition instanceof AccessorDefinition)) &&
+                    node instanceof MemberAccessExpressionNode)
             {
-                write(definition.getQualifiedName());
+                emitClosureStart();
+                getWalker().walk(node);
+                writeToken(ASEmitterTokens.COMMA);
+                getWalker().walk(((MemberAccessExpressionNode)node).getLeftOperandNode());
+                emitClosureEnd(((MemberAccessExpressionNode)node).getLeftOperandNode());
             }
-            else
+            else if (node.getNodeID() == ASTNodeID.XMLContentID)
             {
-        		// AJH need Language.bind here and maybe not require
-            	// that the node is a MemberAccessExpression
-            	if (definition instanceof FunctionDefinition &&
-            			!((FunctionDefinition)definition).isStatic() &&
-            			(!(definition instanceof AccessorDefinition)) &&
-            			node instanceof MemberAccessExpressionNode)
-            	{
-                    emitClosureStart();
-            		getWalker().walk(node);
-                    writeToken(ASEmitterTokens.COMMA);
-            		getWalker().walk(((MemberAccessExpressionNode)node).getLeftOperandNode());
-                    emitClosureEnd(((MemberAccessExpressionNode)node).getLeftOperandNode());
-            	}
-            	else if (node.getNodeID() == ASTNodeID.XMLContentID)
-            	{
-            		write("new XML");
-            		writeToken(ASEmitterTokens.PAREN_OPEN);
-            		getWalker().walk(node);
-            		writeToken(ASEmitterTokens.PAREN_CLOSE);
-            	}
-            	else
-            		getWalker().walk(node);
+                write("new XML");
+                writeToken(ASEmitterTokens.PAREN_OPEN);
+                getWalker().walk(node);
+                writeToken(ASEmitterTokens.PAREN_CLOSE);
             }
+            else
+                getWalker().walk(node);
         }
     }
 
-    @Override
-    public void emitTypedExpression(ITypedExpressionNode node)
-    {
-        getWalker().walk(node.getCollectionNode());
-    }
-
     // XXX Dead
     @Override
     public void emitForEachLoop(IForLoopNode node)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/109b56b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
index 5f590e1..9c4d225 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
@@ -104,16 +104,16 @@ public class FunctionCallEmitter extends JSSubEmitter implements ISubEmitter<IFu
             if (node.isNewExpression())
             {
                 def = node.resolveCalledExpression(getProject());
+                IExpressionNode nameNode = node.getNameNode();
                 // all new calls to a class should be fully qualified names
                 if (def instanceof ClassDefinition)
                 {
-                    getEmitter().startMapping(node);
+                    getEmitter().startMapping(nameNode);
                     write(getEmitter().formatQualifiedName(def.getQualifiedName()));
-                    getEmitter().endMapping(node);
+                    getEmitter().endMapping(nameNode);
                 }
                 else
                 {
-                    IExpressionNode nameNode = node.getNameNode();
                     // wrap "new someFunctionCall(args)" in parens so the
                     // function call gets parsed and evaluated before new
                     // otherwise it just looks like any other "new function"

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/109b56b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
index b945282..3829b68 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
@@ -79,8 +79,14 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
         }
 
         fjs.emitDeclarationName(node);
-        if (!(avnode instanceof IEmbedNode))
+        if (avnode != null && !(avnode instanceof IEmbedNode))
+        {
+            getEmitter().startMapping(node, node.getVariableTypeNode().getEnd() - node.getStart());
+            write(ASEmitterTokens.SPACE);
+            writeToken(ASEmitterTokens.EQUAL);
+            getEmitter().endMapping(node);
             fjs.emitAssignedValue(avnode);
+        }
 
         if (!(node instanceof ChainedVariableNode))
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/109b56b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
index fceccc2..0eb2a78 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
@@ -350,8 +350,12 @@ public class JSVF2JSEmitter extends JSGoogEmitter implements IJSVF2JSEmitter
         }
 
         emitDeclarationName(node);
-        if (!(avnode instanceof IEmbedNode))
+        if (avnode != null && !(avnode instanceof IEmbedNode))
+        {
+            write(ASEmitterTokens.SPACE);
+            writeToken(ASEmitterTokens.EQUAL);
             emitAssignedValue(avnode);
+        }
 
         if (!(node instanceof ChainedVariableNode))
         {


[21/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - arguments are output similar to parameters, with the wrapping (), source maps for parameters and arguments

Posted by cd...@apache.org.
arguments are output similar to parameters, with the wrapping (), source maps for parameters and arguments


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

Branch: refs/heads/feature/maven-migration
Commit: c381df34557b6e6441fa94a0ec09bc485f0faf52
Parents: 4f9787c
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 1 12:45:27 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 1 12:45:27 2016 -0700

----------------------------------------------------------------------
 .../js/sourcemaps/TestSourceMapExpressions.java |  29 +++++
 .../internal/test/SourceMapTestBase.java        |   1 +
 .../flex/compiler/codegen/as/IASEmitter.java    |   2 +
 .../compiler/internal/codegen/as/ASEmitter.java |  31 +++---
 .../compiler/internal/codegen/js/JSEmitter.java |  45 +++++++-
 .../internal/codegen/js/amd/JSAMDEmitter.java   |  38 ++++---
 .../codegen/js/flexjs/JSFlexJSEmitter.java      | 108 ++++++++++++-------
 .../internal/codegen/js/goog/JSGoogEmitter.java |   6 +-
 .../codegen/js/jx/FunctionCallEmitter.java      |  26 ++---
 .../codegen/js/vf2js/JSVF2JSEmitter.java        |   8 +-
 10 files changed, 203 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c381df34/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
index c34f68a..5a94d96 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
@@ -6,6 +6,7 @@ import org.apache.flex.compiler.internal.test.SourceMapTestBase;
 import org.apache.flex.compiler.internal.tree.as.ArrayLiteralNode;
 import org.apache.flex.compiler.internal.tree.as.ObjectLiteralNode;
 import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IContainerNode;
 import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
 import org.apache.flex.compiler.tree.as.IFunctionCallNode;
 import org.apache.flex.compiler.tree.as.IIterationFlowNode;
@@ -665,6 +666,34 @@ public class TestSourceMapExpressions extends SourceMapTestBase
         assertMapping(node, 0, 0, 0, 0, 0, 7);
     }
 
+    @Test
+    public void testVisitFunctionCall_1()
+    {
+        IFunctionCallNode node = (IFunctionCallNode) getNode("a()", IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+        assertMapping(node, 0, 2, 0, 2, 0, 3);
+    }
+
+    @Test
+    public void testVisitFunctionCall_2()
+    {
+        IFunctionCallNode node = (IFunctionCallNode) getNode("a(b)", IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+        assertMapping(node, 0, 3, 0, 3, 0, 4);
+    }
+
+    @Test
+    public void testVisitFunctionCall_3()
+    {
+        IFunctionCallNode node = (IFunctionCallNode) getNode("a(b, c)", IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+        assertMapping(node, 0, 3, 0, 3, 0, 5);
+        assertMapping(node, 0, 6, 0, 6, 0, 7);
+    }
+
     protected IBackend createBackend()
     {
         return new FlexJSBackend();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c381df34/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
index 756674b..a7b18cf 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
@@ -40,6 +40,7 @@ public class SourceMapTestBase extends ASTestBase
                     && endPosition.getColumn() == outEndColumn)
             {
                 foundMapping = true;
+                break;
             }
         }
         assertTrue("Mapping not found for node " + node.toString(), foundMapping);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c381df34/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
index 1a666f1..bd0d1eb 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/as/IASEmitter.java
@@ -306,6 +306,8 @@ public interface IASEmitter extends IEmitter
      * @param node The {@link IFunctionCallNode} node.
      */
     void emitFunctionCall(IFunctionCallNode node);
+    
+    void emitArguments(IContainerNode node);
 
     void emitIterationFlow(IIterationFlowNode node);
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c381df34/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 53ce765..309d156 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
@@ -1135,9 +1135,24 @@ public class ASEmitter implements IASEmitter, IEmitter
         }
 
         getWalker().walk(node.getNameNode());
+        
+        emitArguments(node.getArgumentsNode());
+    }
 
+    @Override
+    public void emitArguments(IContainerNode node)
+    {
         write(ASEmitterTokens.PAREN_OPEN);
-        walkArguments(node.getArgumentNodes());
+        int len = node.getChildCount();
+        for (int i = 0; i < len; i++)
+        {
+            IExpressionNode argumentNode = (IExpressionNode) node.getChild(i);
+            getWalker().walk(argumentNode);
+            if (i < len - 1)
+            {
+                writeToken(ASEmitterTokens.COMMA);
+            }
+        }
         write(ASEmitterTokens.PAREN_CLOSE);
     }
 
@@ -1203,20 +1218,6 @@ public class ASEmitter implements IASEmitter, IEmitter
         return null;
     }
 
-    public void walkArguments(IExpressionNode[] nodes)
-    {
-        int len = nodes.length;
-        for (int i = 0; i < len; i++)
-        {
-            IExpressionNode node = nodes[i];
-            getWalker().walk(node);
-            if (i < len - 1)
-            {
-                writeToken(ASEmitterTokens.COMMA);
-            }
-        }
-    }
-
     //--------------------------------------------------------------------------
     // Static Utility
     //--------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c381df34/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index bd7bf15..5f5b816 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -162,7 +162,10 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
 
     public void emitParameters(IContainerNode node)
     {
+        startMapping(node);
         write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+        
         int len = node.getChildCount();
         for (int i = 0; i < len; i++)
         {
@@ -170,10 +173,19 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
             getWalker().walk(parameterNode); //emitParameter
             if (i < len - 1)
             {
+                //we're mapping the comma to the container, but we use the
+                //parameter line/column in case the comma is not on the same
+                //line as the opening (
+                startMapping(node, parameterNode.getLine(),
+                        parameterNode.getColumn() + parameterNode.getAbsoluteEnd() - parameterNode.getAbsoluteStart());
                 writeToken(ASEmitterTokens.COMMA);
+                endMapping(node);
             }
         }
+
+        startMapping(node, node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
         write(ASEmitterTokens.PAREN_CLOSE);
+        endMapping(node);
     }
 
     @Override
@@ -185,6 +197,35 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     }
 
     @Override
+    public void emitArguments(IContainerNode node)
+    {
+        startMapping(node);
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+        
+        int len = node.getChildCount();
+        for (int i = 0; i < len; i++)
+        {
+            IExpressionNode argumentNode = (IExpressionNode) node.getChild(i);
+            getWalker().walk(argumentNode);
+            if (i < len - 1)
+            {
+                //we're mapping the comma to the container, but we use the
+                //parameter line/column in case the comma is not on the same
+                //line as the opening (
+                startMapping(node, argumentNode.getLine(),
+                        argumentNode.getColumn() + argumentNode.getAbsoluteEnd() - argumentNode.getAbsoluteStart());
+                writeToken(ASEmitterTokens.COMMA);
+                endMapping(node);
+            }
+        }
+
+        startMapping(node, node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
+        write(ASEmitterTokens.PAREN_CLOSE);
+        endMapping(node);
+    }
+
+    @Override
     public void emitNumericLiteral(INumericLiteralNode node)
     {
         startMapping((ISourceLocation) node);
@@ -622,10 +663,10 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
                 if (parentNode != null)
                 {
                     //try the parent node
-                    startMapping(parentNode);
+                    startMapping(parentNode, line, column);
+                    return;
                 }
             }
-            return;
         }
         
         String nodeName = null;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c381df34/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java
index fe00d82..27f1079 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/amd/JSAMDEmitter.java
@@ -42,8 +42,11 @@ 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;
 import org.apache.flex.compiler.internal.definitions.ClassTraitsDefinition;
+import org.apache.flex.compiler.internal.tree.as.ContainerNode;
 import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
+import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
+import org.apache.flex.compiler.internal.tree.as.NodeBase;
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.scopes.IASScope;
@@ -777,34 +780,36 @@ public class JSAMDEmitter extends JSEmitter implements IJSAMDEmitter
 
         getWalker().walk(node.getNameNode());
 
-        write(ASEmitterTokens.PAREN_OPEN);
-        walkArguments(node);
-        write(ASEmitterTokens.PAREN_CLOSE.getToken());
+        emitArguments(node.getArgumentsNode());
     }
 
     @Override
-    public void walkArguments(IExpressionNode[] nodes)
-    {
-    }
-
-    protected void walkArguments(IFunctionCallNode node)
+    public void emitArguments(IContainerNode node)
     {
-        FunctionCallNode fnode = (FunctionCallNode) node;
-        IExpressionNode[] nodes = node.getArgumentNodes();
-        int len = nodes.length;
+        IContainerNode newNode = node;
+        FunctionCallNode fnode = (FunctionCallNode) node.getParent();
+        int len = node.getChildCount();
         if (TempTools.injectThisArgument(fnode, false))
         {
-            write("this");
-            if (len > 0)
+            ContainerNode newArgs = new ContainerNode(len + 1);
+            newArgs.setSourcePath(node.getSourcePath());
+            newArgs.span(node);
+            newArgs.setParent((NodeBase) node.getParent());
+            IdentifierNode thisNode = new IdentifierNode("this");
+            thisNode.setSourcePath(node.getSourcePath());
+            newArgs.addItem(thisNode);
+            for (int i = 0; i < len; i++)
             {
-                write(",");
-                write(" ");
+                newArgs.addItem((NodeBase) node.getChild(i));
             }
+            newNode = newArgs;
         }
 
+        len = newNode.getChildCount();
+        write(ASEmitterTokens.PAREN_OPEN);
         for (int i = 0; i < len; i++)
         {
-            IExpressionNode inode = nodes[i];
+            IExpressionNode inode = (IExpressionNode) newNode.getChild(i);
             if (inode.getNodeID() == ASTNodeID.IdentifierID)
             {
                 emitArgumentIdentifier((IIdentifierNode) inode);
@@ -819,6 +824,7 @@ public class JSAMDEmitter extends JSEmitter implements IJSAMDEmitter
                 writeToken(ASEmitterTokens.COMMA);
             }
         }
+        write(ASEmitterTokens.PAREN_CLOSE);
     }
 
     private void emitArgumentIdentifier(IIdentifierNode node)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c381df34/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 355250f..0eaf7c9 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -59,11 +59,13 @@ import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.projects.FlexProject;
 import org.apache.flex.compiler.internal.tree.as.BinaryOperatorAsNode;
 import org.apache.flex.compiler.internal.tree.as.BlockNode;
+import org.apache.flex.compiler.internal.tree.as.ContainerNode;
 import org.apache.flex.compiler.internal.tree.as.DynamicAccessNode;
 import org.apache.flex.compiler.internal.tree.as.FunctionCallNode;
 import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
 import org.apache.flex.compiler.internal.tree.as.LabeledStatementNode;
 import org.apache.flex.compiler.internal.tree.as.MemberAccessExpressionNode;
+import org.apache.flex.compiler.internal.tree.as.NodeBase;
 import org.apache.flex.compiler.internal.tree.as.NumericLiteralNode;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.tree.ASTNodeID;
@@ -71,6 +73,7 @@ import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IAccessorNode;
 import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
 import org.apache.flex.compiler.tree.as.IClassNode;
+import org.apache.flex.compiler.tree.as.IContainerNode;
 import org.apache.flex.compiler.tree.as.IDefinitionNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
 import org.apache.flex.compiler.tree.as.IFileNode;
@@ -546,12 +549,14 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
     }
 
     @Override
-    public void walkArguments(IExpressionNode[] nodes)
+    public void emitArguments(IContainerNode node)
     {
-    	if (nodes.length == 2)
+        ContainerNode newArgs = null;
+        int len = node.getChildCount();
+    	if (len == 2)
     	{
             ICompilerProject project = getWalker().getProject();;
-    		IFunctionCallNode fcNode = (IFunctionCallNode)(nodes[0].getParent().getParent());
+    		IFunctionCallNode fcNode = (IFunctionCallNode) node.getParent();
     		IExpressionNode nameNode = fcNode.getNameNode();
             IDefinition def = nameNode.resolve(project);
         	if (def != null && def.getBaseName().equals("insertAt"))
@@ -561,45 +566,76 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
         		{
             		if (nameNode instanceof MemberAccessExpressionNode)
             		{
-            			IExpressionNode[] newArgs = new IExpressionNode[3];
-            			newArgs[0] = nodes[0];
-            			newArgs[2] = nodes[1];
-            			newArgs[1] = new NumericLiteralNode("0");
-            			nodes = newArgs;
+                        newArgs = new ContainerNode(len + 1);
+                        newArgs.setSourcePath(node.getSourcePath());
+                        newArgs.span(node);
+                        newArgs.setParent((NodeBase) node.getParent());
+                        newArgs.addItem((NodeBase) node.getChild(0));
+                        NumericLiteralNode extraNode = new NumericLiteralNode("0");
+                        extraNode.setSourcePath(node.getSourcePath());
+                        newArgs.addItem(extraNode);
+                        newArgs.addItem((NodeBase) node.getChild(1));
             		}
     			}
     		}
     	}
-    	super.walkArguments(nodes);
-    	if (nodes.length == 1)
-    	{
+        if (len == 1)
+        {
             ICompilerProject project = getWalker().getProject();;
-    		IFunctionCallNode fcNode = (IFunctionCallNode)(nodes[0].getParent().getParent());
-    		IExpressionNode nameNode = fcNode.getNameNode();
+            IFunctionCallNode fcNode = (IFunctionCallNode) node.getParent();
+            IExpressionNode nameNode = fcNode.getNameNode();
             IDefinition def = nameNode.resolve(project);
-        	if (def != null && def.getBaseName().equals("removeAt"))
-        	{
-        		if (def.getParent() != null &&
-            		def.getParent().getQualifiedName().equals("Array"))
-        		{
-            		if (nameNode instanceof MemberAccessExpressionNode)
-            		{
-            			write(", 1");
-            		}
-    			}
-    		}
-        	else if (def != null && def.getBaseName().equals("parseInt"))
-        	{
-        		IDefinition parentDef = def.getParent();
-        		if (parentDef == null)
-        		{
-            		if (nameNode instanceof IdentifierNode)
-            		{
-            			write(", 10");
-            		}
-    			}
-    		}
-    	}
+            if (def != null && def.getBaseName().equals("removeAt"))
+            {
+                if (def.getParent() != null &&
+                        def.getParent().getQualifiedName().equals("Array"))
+                {
+                    if (nameNode instanceof MemberAccessExpressionNode)
+                    {
+                        newArgs = new ContainerNode(len + 1);
+                        newArgs.setSourcePath(node.getSourcePath());
+                        newArgs.span(node);
+                        newArgs.setParent((NodeBase) node.getParent());
+                        for (int i = 0; i < len; i++)
+                        {
+                            newArgs.addItem((NodeBase) node.getChild(i));
+                        }
+                        NumericLiteralNode extraNode = new NumericLiteralNode("1");
+                        extraNode.setSourcePath(node.getSourcePath());
+                        newArgs.addItem(extraNode);
+                    }
+                }
+            }
+            else if (def != null && def.getBaseName().equals("parseInt"))
+            {
+                IDefinition parentDef = def.getParent();
+                if (parentDef == null)
+                {
+                    if (nameNode instanceof IdentifierNode)
+                    {
+                        newArgs = new ContainerNode(len + 1);
+                        newArgs.setSourcePath(node.getSourcePath());
+                        newArgs.span(node);
+                        newArgs.setParent((NodeBase) node.getParent());
+                        for (int i = 0; i < len; i++)
+                        {
+                            newArgs.addItem((NodeBase) node.getChild(i));
+                        }
+                        NumericLiteralNode extraNode = new NumericLiteralNode("10");
+                        extraNode.setSourcePath(node.getSourcePath());
+                        newArgs.addItem(extraNode);
+                    }
+                }
+            }
+        }
+        if (newArgs != null)
+        {
+            super.emitArguments(newArgs);
+        }
+        else
+        {
+            super.emitArguments(node);
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c381df34/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 d37e258..7fe1657 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
@@ -566,10 +566,8 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
             }
 
             getWalker().walk(node.getNameNode());
-
-            write(ASEmitterTokens.PAREN_OPEN);
-            walkArguments(node.getArgumentNodes());
-            write(ASEmitterTokens.PAREN_CLOSE);
+            
+            emitArguments(node.getArgumentsNode());
         }
         else
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c381df34/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
index ab36794..0b8df4e 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
@@ -125,15 +125,8 @@ public class FunctionCallEmitter extends JSSubEmitter implements ISubEmitter<IFu
                     if (nameNode.hasParenthesis())
                         write(ASEmitterTokens.PAREN_CLOSE);                        
                 }
-                getEmitter().startMapping(node.getArgumentsNode());
-                write(ASEmitterTokens.PAREN_OPEN);
-                getEmitter().endMapping(node.getArgumentsNode());
                 
-                fjs.walkArguments(node.getArgumentNodes());
-                
-                getEmitter().startMapping(node.getArgumentsNode());
-                write(ASEmitterTokens.PAREN_CLOSE);
-                getEmitter().endMapping(node.getArgumentsNode());
+                getEmitter().emitArguments(node.getArgumentsNode());
             }
             else if (!isClassCast)
             {
@@ -155,15 +148,24 @@ public class FunctionCallEmitter extends JSSubEmitter implements ISubEmitter<IFu
                     }
                     else if (def instanceof AppliedVectorDefinition)
                     {
-                        fjs.walkArguments(node.getArgumentNodes());
+                        IExpressionNode[] argumentNodes = node.getArgumentNodes();
+                        int len = argumentNodes.length;
+                        for (int i = 0; i < len; i++)
+                        {
+                            IExpressionNode argumentNode = argumentNodes[i];
+                            getWalker().walk(argumentNode);
+                            if(i < len - 1)
+                            {
+                                write(", ");
+                            }
+                        }
                         write(".slice()");
                         return;
                     }
                 }
             	getWalker().walk(node.getNameNode());
-                write(ASEmitterTokens.PAREN_OPEN);
-                fjs.walkArguments(node.getArgumentNodes());
-                write(ASEmitterTokens.PAREN_CLOSE);
+
+                getEmitter().emitArguments(node.getArgumentsNode());
             }
             else //function-style cast
             {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c381df34/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
index 13bcbb3..4f9d5f2 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/vf2js/JSVF2JSEmitter.java
@@ -656,9 +656,7 @@ public class JSVF2JSEmitter extends JSGoogEmitter implements IJSVF2JSEmitter
                 else
                     // I think we still need this for "new someVarOfTypeClass"
                     getWalker().walk(node.getNameNode());
-                write(ASEmitterTokens.PAREN_OPEN);
-                walkArguments(node.getArgumentNodes());
-                write(ASEmitterTokens.PAREN_CLOSE);
+                emitArguments(node.getArgumentsNode());
             }
             else if (!isClassCast)
             {
@@ -679,9 +677,7 @@ public class JSVF2JSEmitter extends JSGoogEmitter implements IJSVF2JSEmitter
                     }
                 }
                 getWalker().walk(node.getNameNode());
-                write(ASEmitterTokens.PAREN_OPEN);
-                walkArguments(node.getArgumentNodes());
-                write(ASEmitterTokens.PAREN_CLOSE);
+                emitArguments(node.getArgumentsNode());
             }
             else
             {


[26/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - a mapping can't exist on multiple lines, so simply finish the starting line

Posted by cd...@apache.org.
a mapping can't exist on multiple lines, so simply finish the starting line


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

Branch: refs/heads/feature/maven-migration
Commit: c1999209bd5ed1f98a6dce91cb7572a578bad4ba
Parents: 739bef7
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 1 18:02:38 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 1 18:02:38 2016 -0700

----------------------------------------------------------------------
 .../js/sourcemaps/TestSourceMapExpressions.java | 16 ++++++
 .../internal/test/SourceMapTestBase.java        |  6 +-
 .../flex/compiler/codegen/js/IJSEmitter.java    |  6 +-
 .../compiler/internal/codegen/js/JSEmitter.java | 60 +++++++-------------
 .../internal/codegen/js/jx/AsIsEmitter.java     |  6 +-
 .../codegen/js/jx/BinaryOperatorEmitter.java    |  6 +-
 .../codegen/js/jx/MemberAccessEmitter.java      |  2 +-
 .../codegen/js/jx/VarDeclarationEmitter.java    |  6 +-
 8 files changed, 55 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c1999209/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
index 5a94d96..d2dd1dd 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
@@ -588,6 +588,22 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     }
 
     @Test
+    public void testVisitArrayLiteral_4()
+    {
+        ArrayLiteralNode node = (ArrayLiteralNode) getExpressionNode(
+                "a = [0,\n123, 45]", ArrayLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        //[0, 123, 45]
+        assertMapping(node, 0, 0, 0, 0, 0, 1);    // [
+        assertMapping(node, 0, 1, 0, 1, 0, 2);    // 0
+        assertMapping(node, 0, 2, 0, 2, 0, 4);    // ,
+        assertMapping(node, 1, 0, 0, 4, 0, 7);    // 123
+        assertMapping(node, 1, 3, 0, 7, 0, 9);    // ,
+        assertMapping(node, 1, 5, 0, 9, 0, 11);    // 45
+        //TODO: figure out how to place the ] 
+    }
+
+    @Test
     public void testVisitUnaryOperatorNode_Typeof()
     {
         IUnaryOperatorNode node = getUnaryNode("typeof(a)");

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c1999209/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
index a7b18cf..9843267 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
@@ -24,7 +24,11 @@ public class SourceMapTestBase extends ASTestBase
         int outStartLine, int outStartColumn, int outEndLine, int outEndColumn)
     {
         int sourceStartLine = nodeStartLine + node.getLine();
-        int sourceStartColumn = nodeStartColumn + node.getColumn();
+        int sourceStartColumn = nodeStartColumn;
+        if (nodeStartLine == 0)
+        {
+            sourceStartColumn += node.getColumn();
+        }
         boolean foundMapping = false;
         List<IJSEmitter.SourceMapMapping> mappings = jsEmitter.getSourceMapMappings();
         for (IJSEmitter.SourceMapMapping mapping : mappings)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c1999209/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
index d42abe1..82cb7d7 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
@@ -57,10 +57,10 @@ public interface IJSEmitter extends IASEmitter
     void startMapping(ISourceLocation node, int line, int column);
 
     /**
-     * Adds a node to the source map using the space between two nodes instead
-     * of the node's own line and column.
+     * Adds a node to the source map after a particular node instead using the
+     * node's own line and column.
      */
-    void startMapping(ISourceLocation node, ISourceLocation previousNode, ISourceLocation nextNode);
+    void startMapping(ISourceLocation node, ISourceLocation nodeBeforeMapping);
 
     /**
      * Commits a mapping to the source map.

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c1999209/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index ba7cbdf..6839f9e 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -176,8 +176,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
                 //we're mapping the comma to the container, but we use the
                 //parameter line/column in case the comma is not on the same
                 //line as the opening (
-                startMapping(node, parameterNode.getLine(),
-                        parameterNode.getColumn() + parameterNode.getAbsoluteEnd() - parameterNode.getAbsoluteStart());
+                startMapping(node, parameterNode);
                 writeToken(ASEmitterTokens.COMMA);
                 endMapping(node);
             }
@@ -213,8 +212,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
                 //we're mapping the comma to the container, but we use the
                 //parameter line/column in case the comma is not on the same
                 //line as the opening (
-                startMapping(node, argumentNode.getLine(),
-                        argumentNode.getColumn() + argumentNode.getAbsoluteEnd() - argumentNode.getAbsoluteStart());
+                startMapping(node, argumentNode);
                 writeToken(ASEmitterTokens.COMMA);
                 endMapping(node);
             }
@@ -275,10 +273,10 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
             getWalker().walk(child);
             if (i < len - 1)
             {
-                //we're mapping the comma to the literal container, but we use
-                //the child line/column in case the comma is not on the same
-                //line as the opening { or [
-                startMapping(node, child.getLine(), child.getColumn() + child.getAbsoluteEnd() - child.getAbsoluteStart());
+                //we're mapping the comma to the literal container, but we fill
+                //the space between the current child and the next because we
+                //don't know exactly where the comma appears in ActionScript
+                startMapping(node, child);
                 writeToken(ASEmitterTokens.COMMA);
                 endMapping(node);
             }
@@ -308,11 +306,11 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
             endMapping(nameNode);
         }
         
-        IExpressionNode valueNode = node.getValueNode();
-        startMapping(sourceLocationNode, nameNode, valueNode);
+        startMapping(sourceLocationNode, nameNode);
         write(ASEmitterTokens.COLON);
         endMapping(sourceLocationNode);
-        
+
+        IExpressionNode valueNode = node.getValueNode();
         getWalker().walk(valueNode);
     }
 
@@ -348,16 +346,14 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         IExpressionNode leftOperandNode = node.getLeftOperandNode();
         getWalker().walk(leftOperandNode);
         
-        startMapping(node, leftOperandNode.getLine(),
-                leftOperandNode.getColumn() + leftOperandNode.getEnd() - leftOperandNode.getStart());
+        startMapping(node, leftOperandNode);
         write(ASEmitterTokens.SQUARE_OPEN);
         endMapping(node);
         
         IExpressionNode rightOperandNode = node.getRightOperandNode();
         getWalker().walk(rightOperandNode);
 
-        startMapping(node, rightOperandNode.getLine(),
-                rightOperandNode.getColumn() + rightOperandNode.getEnd() - rightOperandNode.getStart());
+        startMapping(node, rightOperandNode);
         write(ASEmitterTokens.SQUARE_CLOSE);
         endMapping(node);
     }
@@ -408,9 +404,9 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         IASNode conditionalExpression = node.getChild(0);
         getWalker().walk(conditionalExpression);
 
-        IContainerNode xnode = (IContainerNode) node.getStatementContentsNode();
-        startMapping(node, conditionalExpression, xnode);
+        startMapping(node, conditionalExpression);
         write(ASEmitterTokens.PAREN_CLOSE);
+        IContainerNode xnode = (IContainerNode) node.getStatementContentsNode();
         if (!isImplicit(xnode))
             write(ASEmitterTokens.SPACE);
         endMapping(node);
@@ -449,7 +445,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         getWalker().walk(conditionalNode);
 
         IExpressionNode leftOperandNode = node.getLeftOperandNode();
-        startMapping(node, conditionalNode, leftOperandNode);
+        startMapping(node, conditionalNode);
         write(ASEmitterTokens.SPACE);
         writeToken(ASEmitterTokens.TERNARY);
         endMapping(node);
@@ -457,7 +453,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         getWalker().walk(leftOperandNode);
 
         IExpressionNode rightOperandNode = node.getRightOperandNode();
-        startMapping(node, leftOperandNode, rightOperandNode);
+        startMapping(node, leftOperandNode);
         write(ASEmitterTokens.SPACE);
         writeToken(ASEmitterTokens.COLON);
         endMapping(node);
@@ -482,7 +478,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         getWalker().walk(conditionalExpression);
 
         IASNode statementContentsNode = node.getStatementContentsNode();
-        startMapping(node, conditionalExpression, statementContentsNode);
+        startMapping(node, conditionalExpression);
         write(ASEmitterTokens.PAREN_CLOSE);
         if (!isImplicit(cnode))
             write(ASEmitterTokens.SPACE);
@@ -506,7 +502,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         getWalker().walk(statementContents);
 
         IASNode conditionalExpressionNode = node.getConditionalExpressionNode();
-        startMapping(node, statementContents, conditionalExpressionNode);
+        startMapping(node, statementContents);
         if (!isImplicit(cnode))
             write(ASEmitterTokens.SPACE);
         else
@@ -518,7 +514,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
 
         getWalker().walk(conditionalExpressionNode);
         
-        startMapping(node, conditionalExpressionNode, conditionalExpressionNode.getSucceedingNode(1));
+        startMapping(node, conditionalExpressionNode);
         write(ASEmitterTokens.PAREN_CLOSE);
         write(ASEmitterTokens.SEMICOLON);
         endMapping(node);
@@ -539,7 +535,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     {
         IExpressionNode operandNode = node.getOperandNode();
         getWalker().walk(operandNode);
-        startMapping(node, operandNode.getLine(), operandNode.getColumn() + operandNode.getAbsoluteEnd() - operandNode.getAbsoluteStart());
+        startMapping(node, operandNode);
         write(node.getOperator().getOperatorText());
         endMapping(node);
     }
@@ -638,21 +634,9 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         startMapping(node, node.getLine(), node.getColumn());
     }
 
-    public void startMapping(ISourceLocation node, ISourceLocation previousNode, ISourceLocation nextNode)
+    public void startMapping(ISourceLocation node, ISourceLocation nodeBeforeMapping)
     {
-        if(previousNode.getLine() == nextNode.getLine())
-        {
-            //start at the end of the previous node
-            startMapping(node, previousNode.getLine(), previousNode.getColumn() + previousNode.getAbsoluteEnd() - previousNode.getAbsoluteStart());
-        }
-        else
-        {
-            //fill the rest of the line with the previous node
-            startMapping(node, previousNode.getLine(), previousNode.getColumn() + previousNode.getAbsoluteEnd() - previousNode.getAbsoluteStart());
-            endMapping(node);
-            //fill the beginning of the line with the next node
-            startMapping(node, nextNode.getLine(), 0);
-        }
+        startMapping(node, nodeBeforeMapping.getLine(), nodeBeforeMapping.getColumn() + nodeBeforeMapping.getAbsoluteEnd() - nodeBeforeMapping.getAbsoluteStart());
     }
     
     public void startMapping(ISourceLocation node, int line, int column)
@@ -703,7 +687,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         {
             throw new IllegalStateException("Cannot end mapping when a mapping has not been started");
         }
-        
+
         lastMapping.destEndPosition = new FilePosition(getCurrentLine(), getCurrentColumn());
         sourceMapMappings.add(lastMapping);
         lastMapping = null;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c1999209/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
index 18c2e05..36e2cd0 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
@@ -136,7 +136,7 @@ public class AsIsEmitter extends JSSubEmitter
         if (node instanceof IBinaryOperatorNode)
         {
             IBinaryOperatorNode binaryOperatorNode = (IBinaryOperatorNode) node; 
-            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode(), binaryOperatorNode.getRightOperandNode());
+            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode());
         }
         else
         {
@@ -157,7 +157,7 @@ public class AsIsEmitter extends JSSubEmitter
         if (node instanceof IBinaryOperatorNode)
         {
             IBinaryOperatorNode binaryOperatorNode = (IBinaryOperatorNode) node;
-            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode(), binaryOperatorNode.getRightOperandNode());
+            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode());
         }
         else
         {
@@ -180,7 +180,7 @@ public class AsIsEmitter extends JSSubEmitter
         if (node instanceof IBinaryOperatorNode)
         {
             IBinaryOperatorNode binaryOperatorNode = (IBinaryOperatorNode) node;
-            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode(), binaryOperatorNode.getRightOperandNode());
+            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode());
         }
         else
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c1999209/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
index b056177..d97c20a 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
@@ -71,7 +71,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
         {
             getWalker().walk(node.getLeftOperandNode());
 
-            getEmitter().startMapping(node, node.getLeftOperandNode(), node.getRightOperandNode());
+            getEmitter().startMapping(node, node.getLeftOperandNode());
             write(ASEmitterTokens.SPACE);
             writeToken(ASEmitterTokens.INSTANCEOF);
             getEmitter().endMapping(node);
@@ -330,7 +330,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
         {
             getWalker().walk(node.getLeftOperandNode());
 
-            getEmitter().startMapping(node, node.getLeftOperandNode(), node.getRightOperandNode());
+            getEmitter().startMapping(node, node.getLeftOperandNode());
             
             if (id != ASTNodeID.Op_CommaID)
                 write(ASEmitterTokens.SPACE);
@@ -346,7 +346,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
                 getEmitter().endMapping(node);
                 write(lnode.getName());
 
-                getEmitter().startMapping(node, node.getLeftOperandNode(), node.getRightOperandNode());
+                getEmitter().startMapping(node, node.getLeftOperandNode());
                 write(ASEmitterTokens.SPACE);
                 write((id == ASTNodeID.Op_LogicalAndAssignID) ? ASEmitterTokens.LOGICAL_AND
                         : ASEmitterTokens.LOGICAL_OR);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c1999209/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
index e5f9a58..1756487 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
@@ -246,7 +246,7 @@ public class MemberAccessEmitter extends JSSubEmitter implements
         	continueWalk = writeLeftSide(node, leftNode, rightNode);
             if (continueWalk)
             {
-                getEmitter().startMapping(node, node.getLeftOperandNode(), node.getRightOperandNode());
+                getEmitter().startMapping(node, node.getLeftOperandNode());
                 write(node.getOperator().getOperatorText());
                 getEmitter().endMapping(node);
             }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c1999209/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
index aed9671..322c778 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
@@ -95,7 +95,7 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
         fjs.emitDeclarationName(node);
         if (avnode != null && !(avnode instanceof IEmbedNode))
         {
-            getEmitter().startMapping(node, node.getVariableTypeNode(), avnode);
+            getEmitter().startMapping(node, node.getVariableTypeNode());
             write(ASEmitterTokens.SPACE);
             writeToken(ASEmitterTokens.EQUAL);
             getEmitter().endMapping(node);
@@ -111,9 +111,7 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
                 IASNode child = node.getChild(i);
                 if (child instanceof ChainedVariableNode)
                 {
-                    getEmitter().startMapping(node,
-                            node.getChild(i - 1),
-                            child);
+                    getEmitter().startMapping(node, node.getChild(i - 1));
                     writeToken(ASEmitterTokens.COMMA);
                     getEmitter().endMapping(node);
                     fjs.emitVarDeclaration((IVariableNode) child);


[17/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - source maps for member access and dynamic access

Posted by cd...@apache.org.
source maps for member access and dynamic access


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

Branch: refs/heads/feature/maven-migration
Commit: f31918b08b8bf0e5b9e79ab19fb22519a2a64624
Parents: 9138c3d
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 1 10:32:07 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 1 10:32:07 2016 -0700

----------------------------------------------------------------------
 .../js/sourcemaps/TestSourceMapExpressions.java | 44 ++++++++++++++++++++
 .../compiler/internal/codegen/js/JSEmitter.java | 21 ++++++++++
 .../codegen/js/jx/MemberAccessEmitter.java      |  4 ++
 3 files changed, 69 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f31918b0/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
index 0d282f8..c34f68a 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
@@ -6,8 +6,10 @@ import org.apache.flex.compiler.internal.test.SourceMapTestBase;
 import org.apache.flex.compiler.internal.tree.as.ArrayLiteralNode;
 import org.apache.flex.compiler.internal.tree.as.ObjectLiteralNode;
 import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
 import org.apache.flex.compiler.tree.as.IFunctionCallNode;
 import org.apache.flex.compiler.tree.as.IIterationFlowNode;
+import org.apache.flex.compiler.tree.as.IMemberAccessExpressionNode;
 import org.apache.flex.compiler.tree.as.IReturnNode;
 import org.apache.flex.compiler.tree.as.ITernaryOperatorNode;
 import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
@@ -385,6 +387,28 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     //----------------------------------
 
     @Test
+    public void testVisitDynamicAccessNode_1()
+    {
+        IDynamicAccessNode node = getDynamicAccessNode("a[b]");
+        asBlockWalker.visitDynamicAccess(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+        assertMapping(node, 0, 3, 0, 3, 0, 4);
+    }
+
+    @Test
+    public void testVisitDynamicAccessNode_2()
+    {
+        IDynamicAccessNode node = getDynamicAccessNode("a[b[c][d]]");
+        asBlockWalker.visitDynamicAccess(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+        assertMapping(node, 0, 3, 0, 3, 0, 4);
+        assertMapping(node, 0, 5, 0, 5, 0, 6);
+        assertMapping(node, 0, 6, 0, 6, 0, 7);
+        assertMapping(node, 0, 8, 0, 8, 0, 9);
+        assertMapping(node, 0, 9, 0, 9, 0, 10);
+    }
+
+    @Test
     public void testVisitBinaryOperatorNode_Comma()
     {
         IBinaryOperatorNode node = getBinaryNode("a, b");
@@ -411,6 +435,26 @@ public class TestSourceMapExpressions extends SourceMapTestBase
     }
 
     @Test
+    public void testVisitMemberAccess_1()
+    {
+        IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getExpressionNode(
+                "a.b", IMemberAccessExpressionNode.class);
+        asBlockWalker.visitMemberAccessExpression(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+    }
+
+    @Test
+    public void testVisitMemberAccess_2()
+    {
+        IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getExpressionNode(
+                "a.b.c.d", IMemberAccessExpressionNode.class);
+        asBlockWalker.visitMemberAccessExpression(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 2);
+        assertMapping(node, 0, 3, 0, 3, 0, 4);
+        assertMapping(node, 0, 5, 0, 5, 0, 6);
+    }
+
+    @Test
     public void testVisitBinaryOperator_In()
     {
         IBinaryOperatorNode node = getBinaryNode("a in b");

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f31918b0/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index e42056c..01a3298 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -39,6 +39,7 @@ import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IConditionalNode;
 import org.apache.flex.compiler.tree.as.IContainerNode;
 import org.apache.flex.compiler.tree.as.IDefinitionNode;
+import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
 import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
@@ -300,6 +301,26 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     }
 
     @Override
+    public void emitDynamicAccess(IDynamicAccessNode node)
+    {
+        IExpressionNode leftOperandNode = node.getLeftOperandNode();
+        getWalker().walk(leftOperandNode);
+        
+        startMapping(node, leftOperandNode.getLine(),
+                leftOperandNode.getColumn() + leftOperandNode.getEnd() - leftOperandNode.getStart());
+        write(ASEmitterTokens.SQUARE_OPEN);
+        endMapping(node);
+        
+        IExpressionNode rightOperandNode = node.getRightOperandNode();
+        getWalker().walk(rightOperandNode);
+
+        startMapping(node, rightOperandNode.getLine(),
+                rightOperandNode.getColumn() + rightOperandNode.getEnd() - rightOperandNode.getStart());
+        write(ASEmitterTokens.SQUARE_CLOSE);
+        endMapping(node);
+    }
+
+    @Override
     public void emitMemberKeyword(IDefinitionNode node)
     {
         IKeywordNode keywordNode = null;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f31918b0/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
index 5175a79..4d9b11a 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
@@ -245,7 +245,11 @@ public class MemberAccessEmitter extends JSSubEmitter implements
         	
         	continueWalk = writeLeftSide(node, leftNode, rightNode);
             if (continueWalk)
+            {
+                getEmitter().startMapping(node, node.getLeftOperandNode().getAbsoluteEnd() - node.getAbsoluteStart());
                 write(node.getOperator().getOperatorText());
+                getEmitter().endMapping(node);
+            }
         }
 
         if (continueWalk)


[16/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - more source map tests

Posted by cd...@apache.org.
more source map tests


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

Branch: refs/heads/feature/maven-migration
Commit: 9138c3d3ea418a05a53e4df7cbe3d197fbdba1a0
Parents: 847dc15
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Mar 30 16:51:17 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Mar 30 16:51:17 2016 -0700

----------------------------------------------------------------------
 .../js/sourcemaps/TestSourceMapExpressions.java | 247 +++++++++++++++++++
 1 file changed, 247 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9138c3d3/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
index 7b06cc7..0d282f8 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
@@ -3,7 +3,13 @@ package org.apache.flex.compiler.internal.codegen.js.sourcemaps;
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
 import org.apache.flex.compiler.internal.test.SourceMapTestBase;
+import org.apache.flex.compiler.internal.tree.as.ArrayLiteralNode;
+import org.apache.flex.compiler.internal.tree.as.ObjectLiteralNode;
 import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IFunctionCallNode;
+import org.apache.flex.compiler.tree.as.IIterationFlowNode;
+import org.apache.flex.compiler.tree.as.IReturnNode;
+import org.apache.flex.compiler.tree.as.ITernaryOperatorNode;
 import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
 
 import org.junit.Test;
@@ -374,6 +380,247 @@ public class TestSourceMapExpressions extends SourceMapTestBase
         assertMapping(node, 0, 1, 0, 5, 0, 9);
     }
 
+    //----------------------------------
+    // Other
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_Comma()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a, b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 3);
+    }
+
+    @Test
+    public void testVisitTernaryOperatorNode()
+    {
+        ITernaryOperatorNode node = (ITernaryOperatorNode) getExpressionNode(
+                "a ? b : c", ITernaryOperatorNode.class);
+        asBlockWalker.visitTernaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 4);
+        assertMapping(node, 0, 5, 0, 5, 0, 8);
+    }
+
+    @Test
+    public void testVisitUnaryOperator_Delete()
+    {
+        IUnaryOperatorNode node = getUnaryNode("delete a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 7);
+    }
+
+    @Test
+    public void testVisitBinaryOperator_In()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a in b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 5);
+    }
+
+    @Test
+    public void testVisitBinaryOperator_Instancof()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a instanceof b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node, 0, 1, 0, 1, 0, 13);
+    }
+
+    @Test
+    public void testVisitBinaryOperator_New()
+    {
+        IFunctionCallNode node = (IFunctionCallNode) getExpressionNode(
+                "new Object()", IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 4);
+    }
+
+    @Test
+    public void testVisitObjectLiteral_1()
+    {
+        ObjectLiteralNode node = (ObjectLiteralNode) getExpressionNode(
+                "a = {a:1}", ObjectLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 1); // {
+        assertMapping(node, 0, 1, 0, 1, 0, 2); // a
+        assertMapping(node, 0, 2, 0, 2, 0, 3); // :
+        assertMapping(node, 0, 4, 0, 4, 0, 5); // }
+    }
+
+    @Test
+    public void testVisitObjectLiteral_2()
+    {
+        ObjectLiteralNode node = (ObjectLiteralNode) getExpressionNode(
+                "a = {a:1,b:{c:2,d:{e:4}}}", ObjectLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        //{a:1, b:{c:2, d:{e:4}}}
+        assertMapping(node, 0, 0, 0, 0, 0, 1);    // {
+        assertMapping(node, 0, 1, 0, 1, 0, 2);    // a
+        assertMapping(node, 0, 2, 0, 2, 0, 3);    // :
+        assertMapping(node, 0, 4, 0, 4, 0, 6);    // ,
+        assertMapping(node, 0, 5, 0, 6, 0, 7);    // b
+        assertMapping(node, 0, 6, 0, 7, 0, 8);    // :
+        assertMapping(node, 0, 7, 0, 8, 0, 9);    // {
+        assertMapping(node, 0, 8, 0, 9, 0, 10);   // c
+        assertMapping(node, 0, 9, 0, 10, 0, 11);  // :
+        assertMapping(node, 0, 11, 0, 12, 0, 14); // ,
+        assertMapping(node, 0, 12, 0, 14, 0, 15); // d
+        assertMapping(node, 0, 13, 0, 15, 0, 16); // :
+        assertMapping(node, 0, 14, 0, 16, 0, 17); // {
+        assertMapping(node, 0, 15, 0, 17, 0, 18); // e
+        assertMapping(node, 0, 16, 0, 18, 0, 19); // :
+        assertMapping(node, 0, 18, 0, 20, 0, 21); // }
+        assertMapping(node, 0, 19, 0, 21, 0, 22); // }
+        assertMapping(node, 0, 20, 0, 22, 0, 23); // }
+        
+    }
+
+    @Test
+    public void testVisitObjectLiteral_3()
+    {
+        ObjectLiteralNode node = (ObjectLiteralNode) getExpressionNode(
+                "a = { a: 12,  bb: 2   \t}", ObjectLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        //{a:12, bb:2}
+        assertMapping(node, 0, 0, 0, 0, 0, 1);    // {
+        assertMapping(node, 0, 2, 0, 1, 0, 2);    // a
+        assertMapping(node, 0, 3, 0, 2, 0, 3);    // :
+        assertMapping(node, 0, 7, 0, 5, 0, 7);    // ,
+        assertMapping(node, 0, 10, 0, 7, 0, 9);   // bb
+        assertMapping(node, 0, 12, 0, 9, 0, 10);  // :
+        assertMapping(node, 0, 19, 0, 11, 0, 12); // }
+    }
+
+    @Test
+    public void testVisitArrayLiteral_1()
+    {
+        ArrayLiteralNode node = (ArrayLiteralNode) getExpressionNode(
+                "a = [0,1,2]", ArrayLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        //[0, 1, 2]
+        assertMapping(node, 0, 0, 0, 0, 0, 1); // [
+        assertMapping(node, 0, 2, 0, 2, 0, 4); // ,
+        assertMapping(node, 0, 4, 0, 5, 0, 7); // ,
+        assertMapping(node, 0, 6, 0, 8, 0, 9); // ]
+    }
+
+    @Test
+    public void testVisitArrayLiteral_2()
+    {
+        ArrayLiteralNode node = (ArrayLiteralNode) getExpressionNode(
+                "a = [0,[0,1,[0,1]],2,[1,2]]", ArrayLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        //[0, [0, 1, [0, 1]], 2, [1, 2]]
+        assertMapping(node, 0, 0, 0, 0, 0, 1);    // [
+        assertMapping(node, 0, 2, 0, 2, 0, 4);    // ,
+        assertMapping(node, 0, 3, 0, 4, 0, 5);    // [
+        assertMapping(node, 0, 5, 0, 6, 0, 8);    // ,
+        assertMapping(node, 0, 7, 0, 9, 0, 11);   // ,
+        assertMapping(node, 0, 8, 0, 11, 0, 12);  // [
+        assertMapping(node, 0, 10, 0, 13, 0, 15); // ,
+        assertMapping(node, 0, 12, 0, 16, 0, 17); // ]
+        assertMapping(node, 0, 13, 0, 17, 0, 18); // ]
+        
+        assertMapping(node, 0, 14, 0, 18, 0, 20); // ,
+        assertMapping(node, 0, 16, 0, 21, 0, 23); // ,
+        assertMapping(node, 0, 17, 0, 23, 0, 24); // [
+        assertMapping(node, 0, 19, 0, 25, 0, 27); // ,
+        assertMapping(node, 0, 21, 0, 28, 0, 29); // ]
+        assertMapping(node, 0, 22, 0, 29, 0, 30); // ]
+    }
+
+    @Test
+    public void testVisitArrayLiteral_3()
+    {
+        ArrayLiteralNode node = (ArrayLiteralNode) getExpressionNode(
+                "a = [ 0,  123, 45   \t]", ArrayLiteralNode.class);
+        asBlockWalker.visitLiteral(node);
+        //[0, 123, 45]
+        assertMapping(node, 0, 0, 0, 0, 0, 1);    // [
+        assertMapping(node, 0, 3, 0, 2, 0, 4);    // ,
+        assertMapping(node, 0, 9, 0, 7, 0, 9);    // ,
+        assertMapping(node, 0, 17, 0, 11, 0, 12); // ]
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_Typeof()
+    {
+        IUnaryOperatorNode node = getUnaryNode("typeof(a)");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 7);
+        assertMapping(node, 0, 0, 0, 8, 0, 9);
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_Typeof_NoParens()
+    {
+        // TODO (mschmalle) the notation without parenthesis is also valid in AS/JS
+        IUnaryOperatorNode node = getUnaryNode("typeof a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 7);
+        assertMapping(node, 0, 0, 0, 8, 0, 9);
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_Void()
+    {
+        IUnaryOperatorNode node = getUnaryNode("void a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 5);
+    }
+
+    @Test
+    public void testVisitIterationFlowNode_BreakWithoutLabel()
+    {
+        IIterationFlowNode node = (IIterationFlowNode) getNode("break",
+                IIterationFlowNode.class);
+        asBlockWalker.visitIterationFlow(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 5);
+    }
+
+    @Test
+    public void testVisitIterationFlowNode_BreakWithLabel()
+    {
+        IIterationFlowNode node = (IIterationFlowNode) getNode("break label",
+                IIterationFlowNode.class);
+        asBlockWalker.visitIterationFlow(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 6);
+    }
+
+    @Test
+    public void testVisitIterationFlowNode_ContinueWithoutLabel()
+    {
+        IIterationFlowNode node = (IIterationFlowNode) getNode("continue",
+                IIterationFlowNode.class);
+        asBlockWalker.visitIterationFlow(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 8);
+    }
+
+    @Test
+    public void testVisitIterationFlowNode_ContinueWithLabel()
+    {
+        IIterationFlowNode node = (IIterationFlowNode) getNode("continue label",
+                IIterationFlowNode.class);
+        asBlockWalker.visitIterationFlow(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 9);
+    }
+
+    @Test
+    public void testVisitReturnWithoutValue()
+    {
+        IReturnNode node = (IReturnNode) getNode("return", IReturnNode.class);
+        asBlockWalker.visitReturn(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 6);
+    }
+
+    @Test
+    public void testVisitReturnWithValue()
+    {
+        IReturnNode node = (IReturnNode) getNode("return 0", IReturnNode.class);
+        asBlockWalker.visitReturn(node);
+        assertMapping(node, 0, 0, 0, 0, 0, 7);
+    }
+
     protected IBackend createBackend()
     {
         return new FlexJSBackend();


[49/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - fix XML Literal handling in more places

Posted by cd...@apache.org.
fix XML Literal handling in more places


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

Branch: refs/heads/feature/maven-migration
Commit: 2135f681de50082ea6d626003b8321eaa9689187
Parents: 7a0a4c8
Author: Alex Harui <ah...@apache.org>
Authored: Sun Apr 10 21:38:57 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Apr 10 21:38:57 2016 -0700

----------------------------------------------------------------------
 .../codegen/js/flexjs/TestFlexJSGlobalClasses.java | 17 +++++++++++++++++
 .../internal/codegen/js/goog/JSGoogEmitter.java    |  7 -------
 .../internal/codegen/js/jx/LiteralEmitter.java     |  5 +++++
 3 files changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2135f681/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
index 32f28f5..864fc24 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
@@ -339,6 +339,23 @@ public class TestFlexJSGlobalClasses extends TestGoogGlobalClasses
     }
     
     @Test
+    public void testXMLLiteralAsParam()
+    {
+        IFunctionCallNode node = (IFunctionCallNode)getNode("var a:XML; a.appendChild(<top attr1='cat'><child attr2='dog'><grandchild attr3='fish'>text</grandchild></child></top>)",
+        		IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertOut("a.appendChild(new XML( \"<top attr1='cat'><child attr2='dog'><grandchild attr3='fish'>text</grandchild></child></top>\") )");
+    }
+    
+    @Test
+    public void testXMLLiteralInReassign()
+    {
+    	IBinaryOperatorNode node = getBinaryNode("var a:XML = <foo />; a = <top attr1='cat'><child attr2='dog'><grandchild attr3='fish'>text</grandchild></child></top>)");
+        asBlockWalker.visitBinaryOperator(node);
+        assertOut("a = new XML( \"<top attr1='cat'><child attr2='dog'><grandchild attr3='fish'>text</grandchild></child></top>\") ");
+    }
+    
+    @Test
     public void testXMLSingleDot()
     {
         IVariableNode node = getVariable("var a:XML = new XML(\"<top attr1='cat'><child attr2='dog'><grandchild attr3='fish'>text</grandchild></child></top>\");var b:XMLList = a.child;");

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2135f681/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 7fe1657..e08fb84 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
@@ -906,13 +906,6 @@ public class JSGoogEmitter extends JSEmitter implements IJSGoogEmitter
                 getWalker().walk(((MemberAccessExpressionNode)node).getLeftOperandNode());
                 emitClosureEnd(((MemberAccessExpressionNode)node).getLeftOperandNode());
             }
-            else if (node.getNodeID() == ASTNodeID.XMLContentID)
-            {
-                write("new XML");
-                writeToken(ASEmitterTokens.PAREN_OPEN);
-                getWalker().walk(node);
-                writeToken(ASEmitterTokens.PAREN_CLOSE);
-            }
             else
                 getWalker().walk(node);
         }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2135f681/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
index a332f23..9b16bb8 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
@@ -21,11 +21,13 @@ package org.apache.flex.compiler.internal.codegen.js.jx;
 
 import org.apache.flex.compiler.codegen.ISubEmitter;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
 import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
 import org.apache.flex.compiler.internal.tree.as.LiteralNode;
 import org.apache.flex.compiler.internal.tree.as.RegExpLiteralNode;
 import org.apache.flex.compiler.internal.tree.as.XMLLiteralNode;
+import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.ILiteralNode;
 import org.apache.flex.compiler.tree.as.ILiteralNode.LiteralType;
@@ -49,6 +51,8 @@ public class LiteralEmitter extends JSSubEmitter implements
         {
             if (node.getLiteralType() == LiteralType.XML)
             {
+                write("new XML");
+                writeToken(ASEmitterTokens.PAREN_OPEN);
             	XMLLiteralNode xmlNode = (XMLLiteralNode)node;
             	if (xmlNode.getContentsNode().getChildCount() == 1)
             	{
@@ -83,6 +87,7 @@ public class LiteralEmitter extends JSSubEmitter implements
             			}
             		}
             	}
+                writeToken(ASEmitterTokens.PAREN_CLOSE);
             }
             s = s.replaceAll("\n", "__NEWLINE_PLACEHOLDER__");
             s = s.replaceAll("\r", "__CR_PLACEHOLDER__");


[39/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - compiler.jx: similar to Language, the XML require is now inserted in the postProcess() method of JSFlexJSEmitter

Posted by cd...@apache.org.
compiler.jx: similar to Language, the XML require is now inserted in the postProcess() method of JSFlexJSEmitter


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

Branch: refs/heads/feature/maven-migration
Commit: 239f935f2a0b35c6d61bc0435e1ea478b6de8784
Parents: 5fc4bfc
Author: Josh Tynjala <jo...@apache.org>
Authored: Thu Apr 7 16:37:55 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Thu Apr 7 16:37:55 2016 -0700

----------------------------------------------------------------------
 .../codegen/js/flexjs/JSFlexJSEmitter.java      | 36 +++++++++-
 .../mxml/flexjs/MXMLFlexJSPublisher.java        | 70 --------------------
 2 files changed, 33 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/239f935f/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index 64d3a29..f23f83a 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -144,6 +144,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
     	String[] lines = output.split("\n");
     	ArrayList<String> finalLines = new ArrayList<String>();
         boolean foundLanguage = false;
+        boolean foundXML = false;
     	boolean sawRequires = false;
     	boolean stillSearching = true;
         int addIndex = -1;
@@ -168,10 +169,14 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                     addIndex = -1;
 	                int c2 = line.indexOf(")");
 	                String s = line.substring(c + 14, c2 - 1);
-                    if(s.equals(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken()))
+                    if (s.equals(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken()))
                     {
                         foundLanguage = true;
                     }
+                    else if (s.equals(IASLanguageConstants.XML))
+                    {
+                        foundXML = true;
+                    }
 	    			sawRequires = true;
 	    			if (!usedNames.contains(s))
                     {
@@ -190,8 +195,9 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                     ICompilerProject project = getWalker().getProject();
                     if (project instanceof FlexJSProject)
                     {
-                        boolean needLanguage = ((FlexJSProject) project).needLanguage;
-                        if(needLanguage && !foundLanguage)
+                        FlexJSProject flexJSProject = (FlexJSProject) project;
+                        boolean needLanguage = flexJSProject.needLanguage;
+                        if (needLanguage && !foundLanguage)
                         {
                             StringBuilder appendString = new StringBuilder();
                             appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
@@ -214,6 +220,30 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                                 addLineToMappings(i);
                             }
                         }
+                        boolean needXML = flexJSProject.needXML;
+                        if (needXML && !foundXML)
+                        {
+                            StringBuilder appendString = new StringBuilder();
+                            appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+                            appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
+                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+                            appendString.append(IASLanguageConstants.XML);
+                            appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+                            appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
+                            appendString.append(ASEmitterTokens.SEMICOLON.getToken());
+                            if(addIndex != -1)
+                            {
+                                // if we didn't find other requires, this index
+                                // points to the line after goog.provide
+                                finalLines.add(addIndex, appendString.toString());
+                                addLineToMappings(addIndex);
+                            }
+                            else
+                            {
+                                finalLines.add(appendString.toString());
+                                addLineToMappings(i);
+                            }
+                        }
                     }
                 }
     		}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/239f935f/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 4dcc1be..dcd1507 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -279,7 +279,6 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
 
         appendExportSymbol(projectIntermediateJSFilePath, projectName);
         appendEncodedCSS(projectIntermediateJSFilePath, projectName);
-        appendLanguageAndXML(projectIntermediateJSFilePath, projectName);
 
         // if (!subsetGoog)
         // {
@@ -527,75 +526,6 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
         }
     }
 
-    private void appendLanguageAndXML(String path, String projectName) throws IOException
-    {
-        StringBuilder appendString = new StringBuilder();
-        appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-        appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
-        appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-        appendString.append(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
-        appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-        appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
-        appendString.append(ASEmitterTokens.SEMICOLON.getToken());
-        appendString.append("\n");
-
-        String fileData = readCode(new File(path));
-        int reqidx = fileData.indexOf(appendString.toString());
-        if (reqidx == -1 && project.needLanguage)
-        {
-	    	boolean afterProvide = false;
-            reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-            if (reqidx == -1)
-            {
-            	afterProvide = true;
-                reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken());
-            }
-            reqidx = fileData.indexOf(";", reqidx);
-            String after = fileData.substring(reqidx + 1);
-            String before = fileData.substring(0, reqidx + 1);
-            if (afterProvide)
-            	before += "\n";
-            String s = before + "\n" + appendString.toString() + after;
-            writeFile(path, s, false);
-        }
-        
-        StringBuilder appendStringXML = new StringBuilder();
-        appendStringXML.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-        appendStringXML.append(ASEmitterTokens.PAREN_OPEN.getToken());
-        appendStringXML.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-        appendStringXML.append(IASLanguageConstants.XML);
-        appendStringXML.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-        appendStringXML.append(ASEmitterTokens.PAREN_CLOSE.getToken());
-        appendStringXML.append(ASEmitterTokens.SEMICOLON.getToken());
-        appendStringXML.append("\n");
-
-        if (project.needXML)
-        {
-	        fileData = readCode(new File(path));
-	        reqidx = fileData.indexOf(appendStringXML.toString());
-	        if (reqidx == -1)
-	        {
-		    	boolean afterProvide = false;
-	            reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-	            if (reqidx == -1)
-	            {
-	            	afterProvide = true;
-	                reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken());
-	            }
-	            reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-	            if (reqidx == -1)
-	                reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken());
-	            reqidx = fileData.indexOf(";", reqidx);
-	            String after = fileData.substring(reqidx + 1);
-	            String before = fileData.substring(0, reqidx + 1);
-	            if (afterProvide)
-	            	before += "\n";
-	            String s = before + "\n" + appendStringXML.toString() + after;
-	            writeFile(path, s, false);
-	        }
-        }
-    }
-
     protected String readCode(File file)
     {
         String code = "";


[42/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - compiler: fixed column of NodeBase when starting after a token

Posted by cd...@apache.org.
compiler: fixed column of NodeBase when starting after a token


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

Branch: refs/heads/feature/maven-migration
Commit: d89a0b29c7e6905677f6b92c35c239e72b16f5d2
Parents: 23f83ec
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 8 11:56:21 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 8 11:56:21 2016 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/compiler/internal/tree/as/NodeBase.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/d89a0b29/compiler/src/org/apache/flex/compiler/internal/tree/as/NodeBase.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/tree/as/NodeBase.java b/compiler/src/org/apache/flex/compiler/internal/tree/as/NodeBase.java
index a6ca29a..be0510d 100644
--- a/compiler/src/org/apache/flex/compiler/internal/tree/as/NodeBase.java
+++ b/compiler/src/org/apache/flex/compiler/internal/tree/as/NodeBase.java
@@ -335,7 +335,10 @@ public abstract class NodeBase extends SourceLocation implements IASNode
     public void startAfter(Token token)
     {
         if (token instanceof ISourceLocation)
-            startAfter((ISourceLocation)token);
+        {
+            startAfter((ISourceLocation) token);
+            setColumn(getColumn() + token.getText().length());
+        }
     }
     
     /**


[45/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - compiler.jx: JSSubEmitters no longer call getEmitter() before startMapping() or endMapping() (just migrating some of the older code to the new style)

Posted by cd...@apache.org.
compiler.jx: JSSubEmitters no longer call getEmitter() before startMapping() or endMapping() (just migrating some of the older code to the new style)


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

Branch: refs/heads/feature/maven-migration
Commit: 4cc081b01c8a86e4408e28d018ab2e14876151fe
Parents: 584f433
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 8 14:17:56 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 8 14:17:56 2016 -0700

----------------------------------------------------------------------
 .../internal/codegen/js/jx/AsIsEmitter.java     | 22 ++++++++++----------
 .../codegen/js/jx/BinaryOperatorEmitter.java    | 12 +++++------
 .../internal/codegen/js/jx/FieldEmitter.java    |  8 +++----
 .../codegen/js/jx/FunctionCallEmitter.java      | 12 +++++------
 .../internal/codegen/js/jx/LiteralEmitter.java  |  4 ++--
 .../codegen/js/jx/MemberAccessEmitter.java      |  8 +++----
 .../internal/codegen/js/jx/MethodEmitter.java   |  8 +++----
 .../codegen/js/jx/VarDeclarationEmitter.java    | 14 ++++++-------
 8 files changed, 44 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4cc081b0/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
index 36e2cd0..793b14f 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
@@ -136,11 +136,11 @@ public class AsIsEmitter extends JSSubEmitter
         if (node instanceof IBinaryOperatorNode)
         {
             IBinaryOperatorNode binaryOperatorNode = (IBinaryOperatorNode) node; 
-            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode());
+            startMapping(node, binaryOperatorNode.getLeftOperandNode());
         }
         else
         {
-            getEmitter().startMapping(node);
+            startMapping(node);
         }
         write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
         write(ASEmitterTokens.MEMBER_ACCESS);
@@ -151,26 +151,26 @@ public class AsIsEmitter extends JSSubEmitter
             write(ASEmitterTokens.AS);
 
         write(ASEmitterTokens.PAREN_OPEN);
-        getEmitter().endMapping(node);
+        endMapping(node);
         
         getWalker().walk(left);
         if (node instanceof IBinaryOperatorNode)
         {
             IBinaryOperatorNode binaryOperatorNode = (IBinaryOperatorNode) node;
-            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode());
+            startMapping(node, binaryOperatorNode.getLeftOperandNode());
         }
         else
         {
-            getEmitter().startMapping(node);
+            startMapping(node);
         }
         writeToken(ASEmitterTokens.COMMA);
-        getEmitter().endMapping(node);
+        endMapping(node);
 
         if (dnode instanceof IClassDefinition)
         {
-            getEmitter().startMapping(right);
+            startMapping(right);
             write(getEmitter().formatQualifiedName(dnode.getQualifiedName()));
-            getEmitter().endMapping(right);
+            endMapping(right);
         }
         else
         {
@@ -180,11 +180,11 @@ public class AsIsEmitter extends JSSubEmitter
         if (node instanceof IBinaryOperatorNode)
         {
             IBinaryOperatorNode binaryOperatorNode = (IBinaryOperatorNode) node;
-            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode());
+            startMapping(node, binaryOperatorNode.getLeftOperandNode());
         }
         else
         {
-            getEmitter().startMapping(node);
+            startMapping(node);
         }
         if (coercion)
         {
@@ -193,7 +193,7 @@ public class AsIsEmitter extends JSSubEmitter
         }
 
         write(ASEmitterTokens.PAREN_CLOSE);
-        getEmitter().endMapping(node);
+        endMapping(node);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4cc081b0/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
index d97c20a..6e5cc75 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
@@ -71,10 +71,10 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
         {
             getWalker().walk(node.getLeftOperandNode());
 
-            getEmitter().startMapping(node, node.getLeftOperandNode());
+            startMapping(node, node.getLeftOperandNode());
             write(ASEmitterTokens.SPACE);
             writeToken(ASEmitterTokens.INSTANCEOF);
-            getEmitter().endMapping(node);
+            endMapping(node);
 
             IDefinition dnode = (node.getRightOperandNode())
                     .resolve(getProject());
@@ -330,7 +330,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
         {
             getWalker().walk(node.getLeftOperandNode());
 
-            getEmitter().startMapping(node, node.getLeftOperandNode());
+            startMapping(node, node.getLeftOperandNode());
             
             if (id != ASTNodeID.Op_CommaID)
                 write(ASEmitterTokens.SPACE);
@@ -343,10 +343,10 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
                         .getLeftOperandNode();
 
                 writeToken(ASEmitterTokens.EQUAL);
-                getEmitter().endMapping(node);
+                endMapping(node);
                 write(lnode.getName());
 
-                getEmitter().startMapping(node, node.getLeftOperandNode());
+                startMapping(node, node.getLeftOperandNode());
                 write(ASEmitterTokens.SPACE);
                 write((id == ASTNodeID.Op_LogicalAndAssignID) ? ASEmitterTokens.LOGICAL_AND
                         : ASEmitterTokens.LOGICAL_OR);
@@ -357,7 +357,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
             }
 
             write(ASEmitterTokens.SPACE);
-            getEmitter().endMapping(node);
+            endMapping(node);
 
             /*
             IDefinition definition = node.getRightOperandNode().resolve(getProject());

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4cc081b0/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
index 8e03b91..402751f 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FieldEmitter.java
@@ -84,11 +84,11 @@ public class FieldEmitter extends JSSubEmitter implements
             if (definition == null)
                 definition = ndef.getContainingScope().getDefinition();
 
-            getEmitter().startMapping(node.getNameExpressionNode());
+            startMapping(node.getNameExpressionNode());
             write(getEmitter().formatQualifiedName(definition.getQualifiedName())
                     + ASEmitterTokens.MEMBER_ACCESS.getToken() + root);
             write(node.getName());
-            getEmitter().endMapping(node.getNameExpressionNode());
+            endMapping(node.getNameExpressionNode());
         }
 
         if (node.getNodeID() == ASTNodeID.BindableVariableID)
@@ -101,10 +101,10 @@ public class FieldEmitter extends JSSubEmitter implements
         if (vnode != null &&
                 (ndef.isStatic() || EmitterUtils.isScalar(vnode) || isPackageOrFileMember))
         {
-            getEmitter().startMapping(node);
+            startMapping(node);
             write(ASEmitterTokens.SPACE);
             writeToken(ASEmitterTokens.EQUAL);
-            getEmitter().endMapping(node);
+            endMapping(node);
             getEmitter().getWalker().walk(vnode);
         }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4cc081b0/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
index ed55481..f1f1923 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
@@ -76,9 +76,9 @@ public class FunctionCallEmitter extends JSSubEmitter implements ISubEmitter<IFu
             {
                 if (!(node.getChild(1) instanceof VectorLiteralNode))
                 {
-                    getEmitter().startMapping(node.getNewKeywordNode());
+                    startMapping(node.getNewKeywordNode());
                     writeToken(ASEmitterTokens.NEW);
-                    getEmitter().endMapping(node.getNewKeywordNode());
+                    endMapping(node.getNewKeywordNode());
                 }
                 else
                 {
@@ -113,9 +113,9 @@ public class FunctionCallEmitter extends JSSubEmitter implements ISubEmitter<IFu
                 // all new calls to a class should be fully qualified names
                 if (def instanceof ClassDefinition)
                 {
-                    getEmitter().startMapping(nameNode);
+                    startMapping(nameNode);
                     write(getEmitter().formatQualifiedName(def.getQualifiedName()));
-                    getEmitter().endMapping(nameNode);
+                    endMapping(nameNode);
                 }
                 else
                 {
@@ -144,12 +144,12 @@ public class FunctionCallEmitter extends JSSubEmitter implements ISubEmitter<IFu
                         ICompilerProject project = this.getProject();
                         if (project instanceof FlexJSProject)
                             ((FlexJSProject) project).needLanguage = true;
-                        getEmitter().startMapping(node.getNameNode());
+                        startMapping(node.getNameNode());
                         write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
                         write(ASEmitterTokens.MEMBER_ACCESS);
                         if (isInt)
                             write(JSFlexJSEmitterTokens.UNDERSCORE);
-                        getEmitter().endMapping(node.getNameNode());
+                        endMapping(node.getNameNode());
                     }
                     else if (def != null && def.getBaseName().equals("sortOn"))
                 	{

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4cc081b0/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
index e3827e6..a332f23 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralEmitter.java
@@ -122,9 +122,9 @@ public class LiteralEmitter extends JSSubEmitter implements
 
         if (!isWritten)
         {
-			getEmitter().startMapping(node);
+			startMapping(node);
             write(s);
-			getEmitter().endMapping(node);
+			endMapping(node);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4cc081b0/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
index 1756487..7088431 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
@@ -246,9 +246,9 @@ public class MemberAccessEmitter extends JSSubEmitter implements
         	continueWalk = writeLeftSide(node, leftNode, rightNode);
             if (continueWalk)
             {
-                getEmitter().startMapping(node, node.getLeftOperandNode());
+                startMapping(node, node.getLeftOperandNode());
                 write(node.getOperator().getOperatorText());
-                getEmitter().endMapping(node);
+                endMapping(node);
             }
         }
 
@@ -313,9 +313,9 @@ public class MemberAccessEmitter extends JSSubEmitter implements
         }
         else
         {
-            getEmitter().startMapping(leftNode);
+            startMapping(leftNode);
             write(ASEmitterTokens.THIS);
-            getEmitter().endMapping(leftNode);
+            endMapping(leftNode);
         }
         return true;
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4cc081b0/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java
index ee2b499..b624621 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MethodEmitter.java
@@ -74,7 +74,7 @@ public class MethodEmitter extends JSSubEmitter implements
         }
         else
         {
-            getEmitter().startMapping(node.getNameExpressionNode());
+            startMapping(node.getNameExpressionNode());
             ITypeDefinition typeDef = EmitterUtils.getTypeDefinition(node);
             if (typeDef != null)
             {
@@ -97,14 +97,14 @@ public class MethodEmitter extends JSSubEmitter implements
             {
                 fjs.emitMemberName(node);
             }
-            getEmitter().endMapping(node.getNameExpressionNode());
+            endMapping(node.getNameExpressionNode());
         }
 
-        getEmitter().startMapping(node);
+        startMapping(node);
         write(ASEmitterTokens.SPACE);
         writeToken(ASEmitterTokens.EQUAL);
         write(ASEmitterTokens.FUNCTION);
-        getEmitter().endMapping(node);
+        endMapping(node);
 
         fjs.emitParameters(node.getParametersContainerNode());
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4cc081b0/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
index 322c778..f43b288 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
@@ -56,7 +56,7 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
         IExpressionNode variableTypeNode = node.getVariableTypeNode();
         if(variableTypeNode.getLine() >= 0)
         {
-            getEmitter().startMapping(variableTypeNode,
+            startMapping(variableTypeNode,
                     variableTypeNode.getLine(),
                     variableTypeNode.getColumn() - 1); //include the :
         }
@@ -67,7 +67,7 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
             //the compiler generates a node for type *.
             //in this case, put it at the end of the name expression.
             IExpressionNode nameExpressionNode = node.getNameExpressionNode();
-            getEmitter().startMapping(variableTypeNode, nameExpressionNode.getLine(),
+            startMapping(variableTypeNode, nameExpressionNode.getLine(),
                     nameExpressionNode.getColumn() + nameExpressionNode.getAbsoluteEnd() - nameExpressionNode.getAbsoluteStart());
         }
         IExpressionNode avnode = node.getAssignedValueNode();
@@ -85,7 +85,7 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
         {
             fjs.getDocEmitter().emitVarDoc(node, null, getWalker().getProject());
         }
-        getEmitter().endMapping(variableTypeNode);
+        endMapping(variableTypeNode);
 
         if (!(node instanceof ChainedVariableNode) && node.isConst())
         {
@@ -95,10 +95,10 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
         fjs.emitDeclarationName(node);
         if (avnode != null && !(avnode instanceof IEmbedNode))
         {
-            getEmitter().startMapping(node, node.getVariableTypeNode());
+            startMapping(node, node.getVariableTypeNode());
             write(ASEmitterTokens.SPACE);
             writeToken(ASEmitterTokens.EQUAL);
-            getEmitter().endMapping(node);
+            endMapping(node);
             fjs.emitAssignedValue(avnode);
         }
 
@@ -111,9 +111,9 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
                 IASNode child = node.getChild(i);
                 if (child instanceof ChainedVariableNode)
                 {
-                    getEmitter().startMapping(node, node.getChild(i - 1));
+                    startMapping(node, node.getChild(i - 1));
                     writeToken(ASEmitterTokens.COMMA);
-                    getEmitter().endMapping(node);
+                    endMapping(node);
                     fjs.emitVarDeclaration((IVariableNode) child);
                 }
             }


[24/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - source maps for chained variables, and some expanded tests for variables in general

Posted by cd...@apache.org.
source maps for chained variables, and some expanded tests for variables in general


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

Branch: refs/heads/feature/maven-migration
Commit: 799f906953c9be6bb909001dda96a46551736053
Parents: 7e47c2d
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 1 16:21:44 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 1 16:21:44 2016 -0700

----------------------------------------------------------------------
 .../js/sourcemaps/TestSourceMapStatements.java  | 62 +++++++++++++++++---
 .../flex/compiler/codegen/js/IJSEmitter.java    |  1 +
 .../compiler/internal/codegen/js/JSEmitter.java | 17 ++++++
 .../codegen/js/jx/VarDeclarationEmitter.java    |  4 ++
 4 files changed, 77 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/799f9069/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
index edb4ed7..713c3cf 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
@@ -20,8 +20,9 @@ public class TestSourceMapStatements extends SourceMapTestBase
                 IVariableNode.class);
         asBlockWalker.visitVariable(node);
         //var /** @type {*} */ a
-        assertMapping(node, 0, 0, 0, 0, 0, 4);
-        assertMapping(node, 0, 5, 0, 4, 0, 21);
+        assertMapping(node, 0, 0, 0, 0, 0, 4);   // var
+        assertMapping(node, 0, 4, 0, 21, 0, 22); // a
+        assertMapping(node, 0, 5, 0, 4, 0, 21);  // (type)
     }
 
     @Test
@@ -31,8 +32,9 @@ public class TestSourceMapStatements extends SourceMapTestBase
                 IVariableNode.class);
         asBlockWalker.visitVariable(node);
         //var /** @type {number} */ a
-        assertMapping(node, 0, 0, 0, 0, 0, 4);
-        assertMapping(node, 0, 5, 0, 4, 0, 26);
+        assertMapping(node, 0, 0, 0, 0, 0, 4);   // var
+        assertMapping(node, 0, 4, 0, 26, 0, 27); // a
+        assertMapping(node, 0, 5, 0, 4, 0, 26);  // :int
     }
 
     @Test
@@ -42,9 +44,55 @@ public class TestSourceMapStatements extends SourceMapTestBase
                 IVariableNode.class);
         asBlockWalker.visitVariable(node);
         //var /** @type {number} */ a = 42
-        assertMapping(node, 0, 0, 0, 0, 0, 4);
-        assertMapping(node, 0, 5, 0, 4, 0, 26);
-        assertMapping(node, 0, 9, 0, 27, 0, 30);
+        assertMapping(node, 0, 0, 0, 0, 0, 4);    // var
+        assertMapping(node, 0, 4, 0, 26, 0, 27);  // a
+        assertMapping(node, 0, 5, 0, 4, 0, 26);   // :int
+        assertMapping(node, 0, 9, 0, 27, 0, 30);  // =
+        assertMapping(node, 0, 12, 0, 30, 0, 32); // 42
+    }
+
+    @Test
+    public void testVarDeclaration_withTypeAssignedValueComplex()
+    {
+        IVariableNode node = (IVariableNode) getNode(
+                "class A { public function b():void { var a:Foo = new Foo(42, 'goo');}} class Foo {}", IVariableNode.class, WRAP_LEVEL_PACKAGE);
+        asBlockWalker.visitVariable(node);
+        //var /** @type {Foo} */ a = new Foo(42, 'goo')
+        assertMapping(node, 0, 0, 0, 0, 0, 4);    // var
+        assertMapping(node, 0, 4, 0, 23, 0, 24);  // a
+        assertMapping(node, 0, 5, 0, 4, 0, 23);   // :Foo
+        assertMapping(node, 0, 9, 0, 24, 0, 27);  // =
+        assertMapping(node, 0, 12, 0, 27, 0, 31);  // new
+        assertMapping(node, 0, 16, 0, 31, 0, 34);  // Foo
+        assertMapping(node, 0, 19, 0, 34, 0, 35);  // (
+        assertMapping(node, 0, 20, 0, 35, 0, 37);  // 42
+        assertMapping(node, 0, 22, 0, 37, 0, 39);  // ,
+        assertMapping(node, 0, 24, 0, 39, 0, 44);  // 'goo'
+        assertMapping(node, 0, 29, 0, 44, 0, 45);  // )
+    }
+
+    @Test
+    public void testVarDeclaration_withList()
+    {
+        IVariableNode node = (IVariableNode) getNode(
+                "var a:int = 4, b:int = 11, c:int = 42;", IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        //var /** @type {number} */ a = 4, /** @type {number} */ b = 11, /** @type {number} */ c = 42
+        assertMapping(node, 0, 0, 0, 0, 0, 4);    // var
+        assertMapping(node, 0, 4, 0, 26, 0, 27);  // a
+        assertMapping(node, 0, 5, 0, 4, 0, 26);   // :int
+        assertMapping(node, 0, 9, 0, 27, 0, 30);  // =
+        assertMapping(node, 0, 12, 0, 30, 0, 31); // 4
+        assertMapping(node, 0, 13, 0, 31, 0, 33); // ,
+        assertMapping(node, 0, 15, 0, 55, 0, 56); // b
+        assertMapping(node, 0, 16, 0, 33, 0, 55); // :int
+        assertMapping(node, 0, 20, 0, 56, 0, 59); // =
+        assertMapping(node, 0, 23, 0, 59, 0, 61); // 11
+        assertMapping(node, 0, 25, 0, 61, 0, 63); // ,
+        assertMapping(node, 0, 27, 0, 85, 0, 86); // c
+        assertMapping(node, 0, 28, 0, 63, 0, 85); // :int
+        assertMapping(node, 0, 32, 0, 86, 0, 89); // =
+        assertMapping(node, 0, 35, 0, 89, 0, 91); // 42
     }
 
     protected IBackend createBackend()

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/799f9069/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
index 6dcea99..56a0c05 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
@@ -47,6 +47,7 @@ public interface IJSEmitter extends IASEmitter
     void startMapping(ISourceLocation node);
     void startMapping(ISourceLocation node, int startOffset);
     void startMapping(ISourceLocation node, int line, int column);
+    void startMapping(ISourceLocation node, ISourceLocation previousNode, ISourceLocation nextNode);
     
     void endMapping(ISourceLocation node);
     void pushSourceMapName(ISourceLocation node);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/799f9069/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index 5f5b816..71c7d6e 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -639,6 +639,23 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     {
         startMapping(node, node.getLine(), node.getColumn() + startOffset);
     }
+
+    public void startMapping(ISourceLocation node, ISourceLocation previousNode, ISourceLocation nextNode)
+    {
+        if(previousNode.getLine() == nextNode.getLine())
+        {
+            //start at the end of the previous node
+            startMapping(node, previousNode.getLine(), previousNode.getColumn() + previousNode.getAbsoluteEnd() - previousNode.getAbsoluteStart());
+        }
+        else
+        {
+            //fill the rest of the line with the previous node
+            startMapping(node, previousNode.getLine(), previousNode.getColumn() + previousNode.getAbsoluteEnd() - previousNode.getAbsoluteStart());
+            endMapping(node);
+            //fill the beginning of the line with the next node
+            startMapping(node, nextNode.getLine(), 0);
+        }
+    }
     
     public void startMapping(ISourceLocation node, int line, int column)
     {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/799f9069/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
index 159a4f0..0cbb60a 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
@@ -98,7 +98,11 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
                 IASNode child = node.getChild(i);
                 if (child instanceof ChainedVariableNode)
                 {
+                    getEmitter().startMapping(node,
+                            node.getChild(i - 1),
+                            child);
                     writeToken(ASEmitterTokens.COMMA);
+                    getEmitter().endMapping(node);
                     fjs.emitVarDeclaration((IVariableNode) child);
                 }
             }


[10/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - source map for instanceof

Posted by cd...@apache.org.
source map for instanceof


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

Branch: refs/heads/feature/maven-migration
Commit: 2dd2b08d5c001e7a264c1dc7e601010eb2903b18
Parents: de36791
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Mar 30 13:33:22 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Mar 30 13:33:22 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java     | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2dd2b08d/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
index 12f3dbd..704c06b 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
@@ -71,8 +71,10 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
         {
             getWalker().walk(node.getLeftOperandNode());
 
+            getEmitter().startMapping(node, node.getLeftOperandNode().getAbsoluteEnd() - node.getAbsoluteStart());
             write(ASEmitterTokens.SPACE);
             writeToken(ASEmitterTokens.INSTANCEOF);
+            getEmitter().endMapping(node);
 
             IDefinition dnode = (node.getRightOperandNode())
                     .resolve(getProject());


[35/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - ObjectLiteralValuePairEmitter: does not create mapping for key in object literal value pair because another emitter will handle that (such as IdentifierEmitter)

Posted by cd...@apache.org.
ObjectLiteralValuePairEmitter: does not create mapping for key in object literal value pair because another emitter will handle that (such as IdentifierEmitter)


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

Branch: refs/heads/feature/maven-migration
Commit: 88a9bc28c44b7af39290b01350deee76af7b4ee3
Parents: 40604f5
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Apr 6 17:26:42 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Apr 6 17:26:42 2016 -0700

----------------------------------------------------------------------
 .../codegen/js/jx/ObjectLiteralValuePairEmitter.java     | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/88a9bc28/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java
index 0c36871..d93d701 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java
@@ -25,7 +25,6 @@ import org.apache.flex.compiler.common.ISourceLocation;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
-import org.apache.flex.compiler.tree.as.ILiteralNode;
 import org.apache.flex.compiler.tree.as.IObjectLiteralValuePairNode;
 
 public class ObjectLiteralValuePairEmitter extends JSSubEmitter implements
@@ -42,15 +41,7 @@ public class ObjectLiteralValuePairEmitter extends JSSubEmitter implements
         ISourceLocation sourceLocationNode = (ISourceLocation) node;
 
         IExpressionNode nameNode = node.getNameNode();
-        if (!(nameNode instanceof ILiteralNode))
-        {
-            startMapping(nameNode);
-        }
-        getWalker().walk(node.getNameNode());
-        if (!(nameNode instanceof ILiteralNode))
-        {
-            endMapping(nameNode);
-        }
+        getWalker().walk(nameNode);
 
         startMapping(sourceLocationNode, nameNode);
         write(ASEmitterTokens.COLON);


[08/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - BinaryOperatorEmitter: fixed source maps for &&= and ||=

Posted by cd...@apache.org.
BinaryOperatorEmitter: fixed source maps for &&= and ||=


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

Branch: refs/heads/feature/maven-migration
Commit: 285ada93c52269fd8c69ec089dc15e01f889a0dc
Parents: 715c92f
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Mar 30 11:37:09 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Mar 30 11:37:09 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/285ada93/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
index 9ef9060..12f3dbd 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
@@ -341,7 +341,11 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
                         .getLeftOperandNode();
 
                 writeToken(ASEmitterTokens.EQUAL);
-                writeToken(lnode.getName());
+                getEmitter().endMapping(node);
+                write(lnode.getName());
+
+                getEmitter().startMapping(node, node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+                write(ASEmitterTokens.SPACE);
                 write((id == ASTNodeID.Op_LogicalAndAssignID) ? ASEmitterTokens.LOGICAL_AND
                         : ASEmitterTokens.LOGICAL_OR);
             }


[28/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - upgrade rat in release script

Posted by cd...@apache.org.
upgrade rat in release script


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

Branch: refs/heads/feature/maven-migration
Commit: ef3baaaff42247f9233c5a45e32445cb916e5778
Parents: bf746d0
Author: Alex Harui <ah...@apache.org>
Authored: Sun Apr 3 22:01:34 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Apr 3 22:01:34 2016 -0700

----------------------------------------------------------------------
 releasecandidate.xml | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ef3baaaf/releasecandidate.xml
----------------------------------------------------------------------
diff --git a/releasecandidate.xml b/releasecandidate.xml
index 2044b02..f87d2f4 100644
--- a/releasecandidate.xml
+++ b/releasecandidate.xml
@@ -49,9 +49,10 @@
     </condition>
 	
 	<property name="rat.report" value="${basedir}/rat-report.txt"/>
-	<property name="apache.rat.jar" value="apache-rat-0.8.jar" />
-	<property name="apache.rat.tasks.jar" value="apache-rat-tasks-0.8.jar" />
-	<property name="apache.rat.url" value="http://people.apache.org/~aharui/rat" />
+    <property name="apache.rat.jar" value="apache-rat-0.11.jar" />
+    <property name="apache.rat.tasks.jar" value="apache-rat-tasks-0.11.jar" />
+    <property name="apache.rat.url" value="http://search.maven.org/remotecontent?filepath=org/apache/rat/apache-rat/0.11" />
+    <property name="apache.rat.tasks.url" value="http://search.maven.org/remotecontent?filepath=org/apache/rat/apache-rat-tasks/0.11" />
     
 	<property file="${basedir}/local.properties" />
 	<property file="${basedir}/build.properties" />
@@ -177,7 +178,7 @@
 		<get src="${apache.rat.url}/${apache.rat.jar}" dest="${env.ANT_HOME}/lib/${apache.rat.jar}" />
 	</target>
 	<target name="install-rat.tasks.jar" unless="apache.rat.tasks.found">
-		<get src="${apache.rat.url}/${apache.rat.tasks.jar}" dest="${env.ANT_HOME}/lib/${apache.rat.tasks.jar}" />
+		<get src="${apache.rat.tasks.url}/${apache.rat.tasks.jar}" dest="${env.ANT_HOME}/lib/${apache.rat.tasks.jar}" />
 	</target>
 	
     <target name="rat-taskdef" description="Rat taskdef">


[44/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - added source maps for some semicolons

Posted by cd...@apache.org.
added source maps for some semicolons


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

Branch: refs/heads/feature/maven-migration
Commit: 584f433777beb32087f7d159346320e7f06468eb
Parents: c759afd
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 8 14:12:41 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 8 14:12:41 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/JSEmitter.java |  8 +++
 .../internal/codegen/js/jx/ClassEmitter.java    |  4 ++
 .../codegen/js/jx/StatementEmitter.java         | 55 ++++++++++++++++++++
 3 files changed, 67 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/584f4337/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index 65a8e63..2ab71b3 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -44,6 +44,7 @@ import org.apache.flex.compiler.internal.codegen.js.jx.ParameterEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.ParametersEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.ReturnEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.SourceMapDirectiveEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.StatementEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.TernaryOperatorEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.UnaryOperatorEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.WhileLoopEmitter;
@@ -95,6 +96,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     public DoWhileLoopEmitter doWhileLoopEmitter;
     public ForLoopEmitter forLoopEmitter;
     public IterationFlowEmitter interationFlowEmitter;
+    public StatementEmitter statementEmitter;
     public SourceMapDirectiveEmitter sourceMapDirectiveEmitter;
     
     @Override
@@ -137,6 +139,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         doWhileLoopEmitter = new DoWhileLoopEmitter(this);
         forLoopEmitter = new ForLoopEmitter(this);
         interationFlowEmitter = new IterationFlowEmitter(this);
+        statementEmitter = new StatementEmitter(this);
         sourceMapDirectiveEmitter = new SourceMapDirectiveEmitter(this);
     }
 
@@ -255,6 +258,11 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     {
         ternaryOperatorEmitter.emit(node);
     }
+    @Override
+    public void emitStatement(IASNode node)
+    {
+        statementEmitter.emit(node);
+    }
 
     @Override
     public void emitIf(IIfNode node)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/584f4337/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java
index 6bf01b7..fe0bc7e 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ClassEmitter.java
@@ -105,7 +105,9 @@ public class ClassEmitter extends JSSubEmitter implements
                 writeNewline();
                 writeNewline();
                 getEmitter().emitField((IVariableNode) dnode);
+                startMapping(dnode, dnode);
                 write(ASEmitterTokens.SEMICOLON);
+                endMapping(dnode);
             }
             else if (dnode.getNodeID() == ASTNodeID.FunctionID)
             {
@@ -135,7 +137,9 @@ public class ClassEmitter extends JSSubEmitter implements
                 writeNewline();
                 writeNewline();
                 getEmitter().emitField((IVariableNode) dnode);
+                startMapping(dnode, dnode);
                 write(ASEmitterTokens.SEMICOLON);
+                endMapping(dnode);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/584f4337/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/StatementEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/StatementEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/StatementEmitter.java
new file mode 100644
index 0000000..7cf897c
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/StatementEmitter.java
@@ -0,0 +1,55 @@
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IStatementNode;
+
+public class StatementEmitter extends JSSubEmitter implements
+        ISubEmitter<IASNode>
+{
+    public StatementEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IASNode node)
+    {
+        getWalker().walk(node);
+
+        // XXX (mschmalle) this should be in the after handler?
+        if (node.getParent().getNodeID() != ASTNodeID.LabledStatementID
+                && node.getNodeID() != ASTNodeID.ConfigBlockID
+                && !(node instanceof IStatementNode))
+        {
+            startMapping(node, node);
+            write(ASEmitterTokens.SEMICOLON);
+            endMapping(node);
+        }
+
+        if (!isLastStatement(node))
+            writeNewline();
+    }
+
+    protected static boolean isLastStatement(IASNode node)
+    {
+        return getChildIndex(node.getParent(), node) == node.getParent()
+                .getChildCount() - 1;
+    }
+
+    // this is not fair that we have to do this if (i < len - 1)
+    private static int getChildIndex(IASNode parent, IASNode node)
+    {
+        final int len = parent.getChildCount();
+        for (int i = 0; i < len; i++)
+        {
+            if (parent.getChild(i) == node)
+                return i;
+        }
+        return -1;
+    }
+}


[29/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - switch nightly version to 0.7.0

Posted by cd...@apache.org.
switch nightly version to 0.7.0


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

Branch: refs/heads/feature/maven-migration
Commit: 0c394f1753fc51c72a279ffec738a0971d6d3e40
Parents: ef3baaa
Author: Alex Harui <ah...@apache.org>
Authored: Mon Apr 4 13:00:41 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Apr 4 13:00:41 2016 -0700

----------------------------------------------------------------------
 build.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/0c394f17/build.properties
----------------------------------------------------------------------
diff --git a/build.properties b/build.properties
index faf4238..e5f94e9 100644
--- a/build.properties
+++ b/build.properties
@@ -17,7 +17,7 @@
 ##
 ################################################################################
 
-release.version = 0.6.0
+release.version = 0.7.0
 
 generated.by.match=/\\*\\*. \\* Generated by Apache Flex Cross-Compiler
 generated.by.comment=/**\n\


[50/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - Merge branches 'develop' and 'feature/maven-migration' of https://git-wip-us.apache.org/repos/asf/flex-falcon into feature/maven-migration

Posted by cd...@apache.org.
Merge branches 'develop' and 'feature/maven-migration' of https://git-wip-us.apache.org/repos/asf/flex-falcon into feature/maven-migration


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

Branch: refs/heads/feature/maven-migration
Commit: 39cad676d0e4406bf0ea9bd8125dfb661c50e411
Parents: f2ae6be 2135f68
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Mon Apr 11 15:19:13 2016 +0200
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Mon Apr 11 15:19:13 2016 +0200

----------------------------------------------------------------------
 build.properties                                |   2 +-
 .../internal/codegen/as/TestExpressions.java    |  24 +
 .../js/flexjs/TestFlexJSGlobalClasses.java      |  18 +
 .../codegen/js/flexjs/TestFlexJSProject.java    |  15 +
 .../codegen/js/flexjs/TestFlexJSStatements.java |  10 +
 .../codegen/js/goog/TestGoogGlobalClasses.java  |   2 +-
 .../js/goog/TestGoogGlobalFunctions.java        |   2 +-
 .../js/sourcemaps/TestSourceMapExpressions.java | 717 +++++++++++++++++++
 .../js/sourcemaps/TestSourceMapStatements.java  | 171 +++++
 .../codegen/mxml/TestMXMLApplication.java       |   2 +-
 .../internal/codegen/mxml/TestMXMLScript.java   |   6 +-
 .../internal/test/SourceMapTestBase.java        |  55 ++
 .../flex/compiler/internal/test/TestBase.java   |  98 ++-
 .../flexjs/projects/xml_requires/XMLRequire.as  |  30 +
 .../projects/xml_requires/XMLRequire_result.js  |  74 ++
 .../flex/compiler/clients/JSConfiguration.java  |  19 +
 .../apache/flex/compiler/clients/MXMLJSC.java   |  43 +-
 .../compiler/codegen/ISourceMapEmitter.java     |  30 +
 .../flex/compiler/codegen/as/IASEmitter.java    |   2 +
 .../flex/compiler/codegen/js/IJSEmitter.java    |  43 ++
 .../flex/compiler/codegen/js/IJSWriter.java     |  10 +
 .../flex/compiler/driver/js/IJSBackend.java     |  29 +
 .../compiler/internal/codegen/as/ASEmitter.java |  97 ++-
 .../compiler/internal/codegen/as/ASWriter.java  |   3 +-
 .../compiler/internal/codegen/js/JSEmitter.java | 369 +++++++++-
 .../internal/codegen/js/JSEmitterTokens.java    |   3 +-
 .../internal/codegen/js/JSSourceMapEmitter.java |  67 ++
 .../internal/codegen/js/JSSubEmitter.java       |  21 +
 .../compiler/internal/codegen/js/JSWriter.java  |  92 ++-
 .../internal/codegen/js/amd/JSAMDEmitter.java   |  36 +-
 .../codegen/js/flexjs/JSFlexJSEmitter.java      | 207 ++++--
 .../internal/codegen/js/goog/JSGoogEmitter.java |  77 +-
 .../internal/codegen/js/jx/AccessorEmitter.java |  10 +-
 .../internal/codegen/js/jx/AsIsEmitter.java     |  46 +-
 .../codegen/js/jx/BinaryOperatorEmitter.java    |  13 +-
 .../internal/codegen/js/jx/ClassEmitter.java    |   8 +
 .../js/jx/DefinePropertyFunctionEmitter.java    |   2 +-
 .../codegen/js/jx/DoWhileLoopEmitter.java       |  71 ++
 .../codegen/js/jx/DynamicAccessEmitter.java     |  54 ++
 .../internal/codegen/js/jx/FieldEmitter.java    |  10 +-
 .../internal/codegen/js/jx/ForLoopEmitter.java  |  99 +++
 .../js/jx/FunctionCallArgumentsEmitter.java     |  64 ++
 .../codegen/js/jx/FunctionCallEmitter.java      |  45 +-
 .../codegen/js/jx/IdentifierEmitter.java        |  14 +
 .../internal/codegen/js/jx/IfEmitter.java       | 117 +++
 .../codegen/js/jx/InterfaceEmitter.java         |   2 +-
 .../codegen/js/jx/IterationFlowEmitter.java     |  54 ++
 .../js/jx/LanguageIdentifierEmitter.java        |  44 ++
 .../codegen/js/jx/LiteralContainerEmitter.java  |  96 +++
 .../internal/codegen/js/jx/LiteralEmitter.java  |   7 +
 .../codegen/js/jx/MemberAccessEmitter.java      |   6 +
 .../codegen/js/jx/MemberKeywordEmitter.java     |  70 ++
 .../internal/codegen/js/jx/MethodEmitter.java   |  13 +-
 .../codegen/js/jx/NumericLiteralEmitter.java    |  43 ++
 .../js/jx/ObjectDefinePropertyEmitter.java      |   4 +-
 .../js/jx/ObjectLiteralValuePairEmitter.java    |  53 ++
 .../codegen/js/jx/PackageFooterEmitter.java     |   2 +
 .../codegen/js/jx/PackageHeaderEmitter.java     |   4 +-
 .../codegen/js/jx/ParameterEmitter.java         |  62 ++
 .../codegen/js/jx/ParametersEmitter.java        |  64 ++
 .../internal/codegen/js/jx/ReturnEmitter.java   |  57 ++
 .../js/jx/SourceMapDirectiveEmitter.java        |  60 ++
 .../codegen/js/jx/StatementEmitter.java         |  55 ++
 .../codegen/js/jx/TernaryOperatorEmitter.java   |  67 ++
 .../codegen/js/jx/UnaryOperatorEmitter.java     | 122 ++++
 .../codegen/js/jx/VarDeclarationEmitter.java    |  30 +-
 .../codegen/js/jx/WhileLoopEmitter.java         |  61 ++
 .../internal/codegen/js/utils/EmitterUtils.java |  86 +++
 .../codegen/js/vf2js/JSVF2JSEmitter.java        |  20 +-
 .../internal/codegen/mxml/MXMLWriter.java       |  24 +-
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  |  20 +
 .../mxml/flexjs/MXMLFlexJSPublisher.java        |  29 +-
 .../compiler/internal/driver/js/JSBackend.java  |  12 +-
 .../internal/projects/FlexJSProject.java        |   5 +
 compiler.tests/.classpath                       |   1 +
 .../compiler/internal/parsing/as/ASParser.g     |  16 +-
 .../compiler/internal/tree/as/NodeBase.java     |   5 +-
 releasecandidate.xml                            |   9 +-
 78 files changed, 3812 insertions(+), 318 deletions(-)
----------------------------------------------------------------------



[20/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - TestExpressions: added tests for function calls

Posted by cd...@apache.org.
TestExpressions: added tests for function calls


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

Branch: refs/heads/feature/maven-migration
Commit: 4f9787cc1b70a04a983b3ef57bc576f6c5714c08
Parents: e1d5ab1
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 1 12:42:34 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 1 12:42:34 2016 -0700

----------------------------------------------------------------------
 .../internal/codegen/as/TestExpressions.java    | 24 ++++++++++++++++++++
 1 file changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4f9787cc/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java
index 85fc8f5..ab7d66f 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/as/TestExpressions.java
@@ -737,4 +737,28 @@ public class TestExpressions extends ASTestBase
         asBlockWalker.visitReturn(node);
         assertOut("return");
     }
+
+    @Test
+    public void testVisitFunctionCall_1()
+    {
+        IFunctionCallNode node = (IFunctionCallNode) getNode("a()", IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertOut("a()");
+    }
+
+    @Test
+    public void testVisitFunctionCall_2()
+    {
+        IFunctionCallNode node = (IFunctionCallNode) getNode("a(b)", IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertOut("a(b)");
+    }
+
+    @Test
+    public void testVisitFunctionCall_3()
+    {
+        IFunctionCallNode node = (IFunctionCallNode) getNode("a(b, c)", IFunctionCallNode.class);
+        asBlockWalker.visitFunctionCall(node);
+        assertOut("a(b, c)");
+    }
 }


[43/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - added source maps for for loop, and renamed emitters for while and do-while loops

Posted by cd...@apache.org.
added source maps for for loop, and renamed emitters for while and do-while loops


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

Branch: refs/heads/feature/maven-migration
Commit: c759afdfc4f3ac1128b7a0d7a08dbf40b2b0dfa3
Parents: d89a0b2
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 8 13:55:45 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 8 13:55:45 2016 -0700

----------------------------------------------------------------------
 .../js/sourcemaps/TestSourceMapStatements.java  | 69 ++++++++++++++
 .../compiler/internal/codegen/js/JSEmitter.java | 26 +++--
 .../internal/codegen/js/jx/DoWhileEmitter.java  | 71 --------------
 .../codegen/js/jx/DoWhileLoopEmitter.java       | 71 ++++++++++++++
 .../internal/codegen/js/jx/ForLoopEmitter.java  | 99 ++++++++++++++++++++
 .../internal/codegen/js/jx/WhileEmitter.java    | 61 ------------
 .../codegen/js/jx/WhileLoopEmitter.java         | 61 ++++++++++++
 7 files changed, 318 insertions(+), 140 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c759afdf/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
index 713c3cf..3c25d07 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
@@ -3,6 +3,7 @@ package org.apache.flex.compiler.internal.codegen.js.sourcemaps;
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
 import org.apache.flex.compiler.internal.test.SourceMapTestBase;
+import org.apache.flex.compiler.tree.as.IForLoopNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;
 
 import org.junit.Test;
@@ -95,6 +96,74 @@ public class TestSourceMapStatements extends SourceMapTestBase
         assertMapping(node, 0, 35, 0, 89, 0, 91); // 42
     }
 
+    //----------------------------------
+    // for () { }
+    //----------------------------------
+
+    @Test
+    public void testVisitFor_1a()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int = 0; i < len; i++) { break; }",
+                IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        //for (var /** @type {number} */ i = 0; i < len; i++) {\n  break;\n}
+        assertMapping(node, 0, 0, 0, 0, 0, 5);    // for (
+        assertMapping(node, 0, 18, 0, 36, 0, 38); // ;
+        assertMapping(node, 0, 27, 0, 45, 0, 47); // ;
+        assertMapping(node, 0, 32, 0, 50, 0, 52); // )
+    }
+
+    @Test
+    public void testVisitFor_1b()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int = 0; i < len; i++) break;", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        //for (var /** @type {number} */ i = 0; i < len; i++)\n  break;
+        assertMapping(node, 0, 0, 0, 0, 0, 5);    // for (
+        assertMapping(node, 0, 18, 0, 36, 0, 38); // ;
+        assertMapping(node, 0, 27, 0, 45, 0, 47); // ;
+        assertMapping(node, 0, 32, 0, 50, 0, 51); // )
+    }
+
+    @Test
+    public void testVisitFor_2()
+    {
+        IForLoopNode node = (IForLoopNode) getNode("for (;;) { break; }",
+                IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        //for (;;) {\n  break;\n}
+        assertMapping(node, 0, 0, 0, 0, 0, 5); // for (
+        assertMapping(node, 0, 5, 0, 5, 0, 6); // ;
+        assertMapping(node, 0, 6, 0, 6, 0, 7); // ;
+        assertMapping(node, 0, 7, 0, 7, 0, 9); // )
+    }
+
+    @Test
+    public void testVisitForIn_1()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int in obj) { break; }", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        //for (var /** @type {number} */ i in obj) {\n  break;\n}
+        assertMapping(node, 0, 0, 0, 0, 0, 5);    // for (
+        assertMapping(node, 0, 14, 0, 32, 0, 36); // in
+        assertMapping(node, 0, 21, 0, 39, 0, 41); // )
+    }
+
+    @Test
+    public void testVisitForIn_1a()
+    {
+        IForLoopNode node = (IForLoopNode) getNode(
+                "for (var i:int in obj)  break; ", IForLoopNode.class);
+        asBlockWalker.visitForLoop(node);
+        //for (var /** @type {number} */ i in obj)\n  break;
+        assertMapping(node, 0, 0, 0, 0, 0, 5);    // for (
+        assertMapping(node, 0, 14, 0, 32, 0, 36); // in
+        assertMapping(node, 0, 21, 0, 39, 0, 40); // )
+    }
+
     protected IBackend createBackend()
     {
         return new FlexJSBackend();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c759afdf/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index 589cbaf..65a8e63 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -30,8 +30,9 @@ import org.apache.flex.compiler.common.ISourceLocation;
 import org.apache.flex.compiler.definitions.ITypeDefinition;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitter;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
-import org.apache.flex.compiler.internal.codegen.js.jx.DoWhileEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.DoWhileLoopEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.DynamicAccessEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.ForLoopEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.FunctionCallArgumentsEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.IfEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.IterationFlowEmitter;
@@ -45,13 +46,14 @@ import org.apache.flex.compiler.internal.codegen.js.jx.ReturnEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.SourceMapDirectiveEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.TernaryOperatorEmitter;
 import org.apache.flex.compiler.internal.codegen.js.jx.UnaryOperatorEmitter;
-import org.apache.flex.compiler.internal.codegen.js.jx.WhileEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.WhileLoopEmitter;
 import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IContainerNode;
 import org.apache.flex.compiler.tree.as.IDefinitionNode;
 import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
+import org.apache.flex.compiler.tree.as.IForLoopNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
 import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
 import org.apache.flex.compiler.tree.as.IIfNode;
@@ -89,8 +91,9 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     public TernaryOperatorEmitter ternaryOperatorEmitter;
     public MemberKeywordEmitter memberKeywordEmitter;
     public IfEmitter ifEmitter;
-    public WhileEmitter whileEmitter;
-    public DoWhileEmitter doWhileEmitter;
+    public WhileLoopEmitter whileLoopEmitter;
+    public DoWhileLoopEmitter doWhileLoopEmitter;
+    public ForLoopEmitter forLoopEmitter;
     public IterationFlowEmitter interationFlowEmitter;
     public SourceMapDirectiveEmitter sourceMapDirectiveEmitter;
     
@@ -130,8 +133,9 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         ternaryOperatorEmitter = new TernaryOperatorEmitter(this);
         memberKeywordEmitter = new MemberKeywordEmitter(this);
         ifEmitter = new IfEmitter(this);
-        whileEmitter = new WhileEmitter(this);
-        doWhileEmitter = new DoWhileEmitter(this);
+        whileLoopEmitter = new WhileLoopEmitter(this);
+        doWhileLoopEmitter = new DoWhileLoopEmitter(this);
+        forLoopEmitter = new ForLoopEmitter(this);
         interationFlowEmitter = new IterationFlowEmitter(this);
         sourceMapDirectiveEmitter = new SourceMapDirectiveEmitter(this);
     }
@@ -261,13 +265,19 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     @Override
     public void emitWhileLoop(IWhileLoopNode node)
     {
-        whileEmitter.emit(node);
+        whileLoopEmitter.emit(node);
     }
 
     @Override
     public void emitDoLoop(IWhileLoopNode node)
     {
-        doWhileEmitter.emit(node);
+        doWhileLoopEmitter.emit(node);
+    }
+
+    @Override
+    public void emitForLoop(IForLoopNode node)
+    {
+        forLoopEmitter.emit(node);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c759afdf/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DoWhileEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DoWhileEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DoWhileEmitter.java
deleted file mode 100644
index 4dfafac..0000000
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DoWhileEmitter.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.apache.flex.compiler.internal.codegen.js.jx;
-
-import org.apache.flex.compiler.codegen.ISubEmitter;
-import org.apache.flex.compiler.codegen.js.IJSEmitter;
-import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
-import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
-import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
-import org.apache.flex.compiler.tree.as.IASNode;
-import org.apache.flex.compiler.tree.as.IContainerNode;
-import org.apache.flex.compiler.tree.as.IWhileLoopNode;
-
-public class DoWhileEmitter extends JSSubEmitter implements
-        ISubEmitter<IWhileLoopNode>
-{
-    public DoWhileEmitter(IJSEmitter emitter)
-    {
-        super(emitter);
-    }
-
-    @Override
-    public void emit(IWhileLoopNode node)
-    {
-        IContainerNode cnode = (IContainerNode) node.getChild(0);
-
-        startMapping(node);
-        write(ASEmitterTokens.DO);
-        if (!EmitterUtils.isImplicit(cnode))
-            write(ASEmitterTokens.SPACE);
-        endMapping(node);
-
-        IASNode statementContents = node.getStatementContentsNode();
-        getWalker().walk(statementContents);
-
-        IASNode conditionalExpressionNode = node.getConditionalExpressionNode();
-        startMapping(node, statementContents);
-        if (!EmitterUtils.isImplicit(cnode))
-            write(ASEmitterTokens.SPACE);
-        else
-            writeNewline(); // TODO (mschmalle) there is something wrong here, block should NL
-        write(ASEmitterTokens.WHILE);
-        write(ASEmitterTokens.SPACE);
-        write(ASEmitterTokens.PAREN_OPEN);
-        endMapping(node);
-
-        getWalker().walk(conditionalExpressionNode);
-
-        startMapping(node, conditionalExpressionNode);
-        write(ASEmitterTokens.PAREN_CLOSE);
-        write(ASEmitterTokens.SEMICOLON);
-        endMapping(node);
-    }
-}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c759afdf/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DoWhileLoopEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DoWhileLoopEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DoWhileLoopEmitter.java
new file mode 100644
index 0000000..e087bcd
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DoWhileLoopEmitter.java
@@ -0,0 +1,71 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+import org.apache.flex.compiler.tree.as.IWhileLoopNode;
+
+public class DoWhileLoopEmitter extends JSSubEmitter implements
+        ISubEmitter<IWhileLoopNode>
+{
+    public DoWhileLoopEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IWhileLoopNode node)
+    {
+        IContainerNode cnode = (IContainerNode) node.getChild(0);
+
+        startMapping(node);
+        write(ASEmitterTokens.DO);
+        if (!EmitterUtils.isImplicit(cnode))
+            write(ASEmitterTokens.SPACE);
+        endMapping(node);
+
+        IASNode statementContents = node.getStatementContentsNode();
+        getWalker().walk(statementContents);
+
+        IASNode conditionalExpressionNode = node.getConditionalExpressionNode();
+        startMapping(node, statementContents);
+        if (!EmitterUtils.isImplicit(cnode))
+            write(ASEmitterTokens.SPACE);
+        else
+            writeNewline(); // TODO (mschmalle) there is something wrong here, block should NL
+        write(ASEmitterTokens.WHILE);
+        write(ASEmitterTokens.SPACE);
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+
+        getWalker().walk(conditionalExpressionNode);
+
+        startMapping(node, conditionalExpressionNode);
+        write(ASEmitterTokens.PAREN_CLOSE);
+        write(ASEmitterTokens.SEMICOLON);
+        endMapping(node);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c759afdf/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ForLoopEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ForLoopEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ForLoopEmitter.java
new file mode 100644
index 0000000..567b029
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ForLoopEmitter.java
@@ -0,0 +1,99 @@
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
+import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+import org.apache.flex.compiler.tree.as.IForLoopNode;
+
+public class ForLoopEmitter extends JSSubEmitter implements
+        ISubEmitter<IForLoopNode>
+{
+    public ForLoopEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IForLoopNode node)
+    {
+        IContainerNode xnode = (IContainerNode) node.getChild(1);
+
+        startMapping(node);
+        writeToken(ASEmitterTokens.FOR);
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+
+        IContainerNode cnode = node.getConditionalsContainerNode();
+        final IASNode node0 = cnode.getChild(0);
+        if (node0.getNodeID() == ASTNodeID.Op_InID)
+        {
+            //for(in)
+            getWalker().walk(cnode.getChild(0));
+        }
+        else //for(;;)
+        {
+            emitForStatements(cnode);
+        }
+
+        startMapping(node, cnode);
+        write(ASEmitterTokens.PAREN_CLOSE);
+        if (!EmitterUtils.isImplicit(xnode))
+            write(ASEmitterTokens.SPACE);
+        endMapping(node);
+
+        getWalker().walk(node.getStatementContentsNode());
+    }
+
+    protected void emitForStatements(IContainerNode node)
+    {
+        final IASNode node0 = node.getChild(0);
+        final IASNode node1 = node.getChild(1);
+        final IASNode node2 = node.getChild(2);
+
+        int column = node.getColumn();
+        // initializer
+        if (node0 != null)
+        {
+            getWalker().walk(node0);
+
+            if (node1.getNodeID() != ASTNodeID.NilID)
+            {
+                column += node0.getAbsoluteEnd() - node0.getAbsoluteStart();
+            }
+            startMapping(node, node.getLine(), column);
+            write(ASEmitterTokens.SEMICOLON);
+            column++;
+            if (node1.getNodeID() != ASTNodeID.NilID)
+            {
+                write(ASEmitterTokens.SPACE);
+                column++;
+            }
+            endMapping(node);
+        }
+        // condition or target
+        if (node1 != null)
+        {
+            getWalker().walk(node1);
+            
+            if (node1.getNodeID() != ASTNodeID.NilID)
+            {
+                column += node1.getAbsoluteEnd() - node1.getAbsoluteStart();
+            }
+            startMapping(node, node.getLine(), column);
+            write(ASEmitterTokens.SEMICOLON);
+            if (node2.getNodeID() != ASTNodeID.NilID)
+                write(ASEmitterTokens.SPACE);
+            endMapping(node);
+        }
+        // iterator
+        if (node2 != null)
+        {
+            getWalker().walk(node2);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c759afdf/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/WhileEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/WhileEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/WhileEmitter.java
deleted file mode 100644
index 8ff0e84..0000000
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/WhileEmitter.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-package org.apache.flex.compiler.internal.codegen.js.jx;
-
-import org.apache.flex.compiler.codegen.ISubEmitter;
-import org.apache.flex.compiler.codegen.js.IJSEmitter;
-import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
-import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
-import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
-import org.apache.flex.compiler.tree.as.IASNode;
-import org.apache.flex.compiler.tree.as.IContainerNode;
-import org.apache.flex.compiler.tree.as.IWhileLoopNode;
-
-public class WhileEmitter extends JSSubEmitter implements
-        ISubEmitter<IWhileLoopNode>
-{
-    public WhileEmitter(IJSEmitter emitter)
-    {
-        super(emitter);
-    }
-
-    @Override
-    public void emit(IWhileLoopNode node)
-    {
-        IContainerNode cnode = (IContainerNode) node.getChild(1);
-
-        startMapping(node);
-        writeToken(ASEmitterTokens.WHILE);
-        write(ASEmitterTokens.PAREN_OPEN);
-        endMapping(node);
-
-        IASNode conditionalExpression = node.getConditionalExpressionNode();
-        getWalker().walk(conditionalExpression);
-
-        IASNode statementContentsNode = node.getStatementContentsNode();
-        startMapping(node, conditionalExpression);
-        write(ASEmitterTokens.PAREN_CLOSE);
-        if (!EmitterUtils.isImplicit(cnode))
-            write(ASEmitterTokens.SPACE);
-        endMapping(node);
-
-        getWalker().walk(statementContentsNode);
-    }
-}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c759afdf/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/WhileLoopEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/WhileLoopEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/WhileLoopEmitter.java
new file mode 100644
index 0000000..54f663d
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/WhileLoopEmitter.java
@@ -0,0 +1,61 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+import org.apache.flex.compiler.tree.as.IWhileLoopNode;
+
+public class WhileLoopEmitter extends JSSubEmitter implements
+        ISubEmitter<IWhileLoopNode>
+{
+    public WhileLoopEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IWhileLoopNode node)
+    {
+        IContainerNode cnode = (IContainerNode) node.getChild(1);
+
+        startMapping(node);
+        writeToken(ASEmitterTokens.WHILE);
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+
+        IASNode conditionalExpression = node.getConditionalExpressionNode();
+        getWalker().walk(conditionalExpression);
+
+        IASNode statementContentsNode = node.getStatementContentsNode();
+        startMapping(node, conditionalExpression);
+        write(ASEmitterTokens.PAREN_CLOSE);
+        if (!EmitterUtils.isImplicit(cnode))
+            write(ASEmitterTokens.SPACE);
+        endMapping(node);
+
+        getWalker().walk(statementContentsNode);
+    }
+}


[33/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - compiler.jx.tests: fixed sdk.dependent.tests for JSEmitter improvements

Posted by cd...@apache.org.
compiler.jx.tests: fixed sdk.dependent.tests for JSEmitter improvements


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

Branch: refs/heads/feature/maven-migration
Commit: 3e5e4fed04c1451d0ebc746ebb9b27d48bd8fc20
Parents: dd409d3
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Apr 6 09:47:57 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Apr 6 09:47:57 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/mxml/TestMXMLApplication.java    | 2 +-
 .../flex/compiler/internal/codegen/mxml/TestMXMLScript.java    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3e5e4fed/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLApplication.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLApplication.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLApplication.java
index 68a3817..fbfe6b8 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLApplication.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLApplication.java
@@ -83,7 +83,7 @@ public class TestMXMLApplication extends MXMLTestBase
 
         mxmlBlockWalker.visitFile(node);
 
-        assertOut("<Application>\n\t<script><![CDATA[\n\t\tprivate const GREETING:String = \"Hello world!\";\n\t]]></script>\n</Application>");
+        assertOut("<Application>\n\t<script><![CDATA[\n\t\tprivate var GREETING:String = \"Hello world!\";\n\t]]></script>\n</Application>");
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3e5e4fed/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
index 3e49131..912ff45 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/mxml/TestMXMLScript.java
@@ -42,7 +42,7 @@ public class TestMXMLScript extends MXMLTestBase
     public void testSimpleScript()
     {
         String code = "" + "<fx:Script><![CDATA["
-                + "    private const GREETING:String = \"Hello world!\";"
+                + "    private var GREETING:String = \"Hello world!\";"
                 + "]]></fx:Script>";
 
         IMXMLScriptNode node = (IMXMLScriptNode) getNode(code,
@@ -50,7 +50,7 @@ public class TestMXMLScript extends MXMLTestBase
 
         mxmlBlockWalker.visitScript(node);
 
-        assertOut("<script><![CDATA[\n\tprivate const GREETING:String = \"Hello world!\";\n]]></script>");
+        assertOut("<script><![CDATA[\n\tprivate var GREETING:String = \"Hello world!\";\n]]></script>");
     }
 
     @Test
@@ -66,7 +66,7 @@ public class TestMXMLScript extends MXMLTestBase
 
         mxmlBlockWalker.visitScript(node);
 
-        assertOut("<script><![CDATA[\n\tpublic var goodbye:String = \"Bye bye :-(\";\n\tprivate const GREETING:String = \"Hello world!\";\n]]></script>");
+        assertOut("<script><![CDATA[\n\tpublic var goodbye:String = \"Bye bye :-(\";\n\tprivate var GREETING:String = \"Hello world!\";\n]]></script>");
     }
 
     @Test


[19/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - ASParser: fixed starting position of function call arguments to include ( as documented

Posted by cd...@apache.org.
ASParser: fixed starting position of function call arguments to include ( as documented


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

Branch: refs/heads/feature/maven-migration
Commit: e1d5ab16711babe35c18218ebf0559426e0a04ca
Parents: fd2f51c
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 1 12:42:02 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 1 12:42:02 2016 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/compiler/internal/parsing/as/ASParser.g    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e1d5ab16/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g b/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
index 443aaeb..835f63a 100644
--- a/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
+++ b/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
@@ -3113,7 +3113,7 @@ arguments[ExpressionNodeBase root] returns[ExpressionNodeBase n]
                     oldNode.setNewKeywordNode(null);
                 }
     		args = ((FunctionCallNode)n).getArgumentsNode();
-    		args.startAfter(lpT);
+    		args.startBefore(lpT);
     		args.endAfter(lpT);
     		disableSemicolonInsertion();
     	} 


[07/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - source maps can be specified at a specific line and column (instead of the line and column where the node starts), and updated how literal containers map their commas

Posted by cd...@apache.org.
source maps can be specified at a specific line and column (instead of the line and column where the node starts), and updated how literal containers map their commas


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

Branch: refs/heads/feature/maven-migration
Commit: 715c92fc44f9128adb35a4c60f986b46bc7d988d
Parents: 74cb443
Author: Josh Tynjala <jo...@apache.org>
Authored: Tue Mar 29 16:53:28 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Tue Mar 29 16:53:28 2016 -0700

----------------------------------------------------------------------
 .../flex/compiler/codegen/js/IJSEmitter.java      |  2 ++
 .../compiler/internal/codegen/js/JSEmitter.java   | 18 ++++++++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/715c92fc/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
index 6aa7f61..6dcea99 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
@@ -46,6 +46,8 @@ public interface IJSEmitter extends IASEmitter
     
     void startMapping(ISourceLocation node);
     void startMapping(ISourceLocation node, int startOffset);
+    void startMapping(ISourceLocation node, int line, int column);
+    
     void endMapping(ISourceLocation node);
     void pushSourceMapName(ISourceLocation node);
     void popSourceMapName();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/715c92fc/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index cec48b9..08fc599 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -228,7 +228,10 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
             getWalker().walk(child);
             if (i < len - 1)
             {
-                startMapping(node, child.getAbsoluteEnd() - node.getAbsoluteStart() + 1);
+                //we're mapping the comma to the literal container, but we use
+                //the child line/column in case the comma is not on the same
+                //line as the opening { or [
+                startMapping(node, child.getLine(), child.getColumn() + child.getEnd() - child.getStart());
                 writeToken(ASEmitterTokens.COMMA);
                 endMapping(node);
             }
@@ -516,11 +519,16 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
 
     public void startMapping(ISourceLocation node)
     {
-        startMapping(node, 0);
+        startMapping(node, node.getLine(), node.getColumn());
     }
-    
+
     public void startMapping(ISourceLocation node, int startOffset)
     {
+        startMapping(node, node.getLine(), node.getColumn() + startOffset);
+    }
+    
+    public void startMapping(ISourceLocation node, int line, int column)
+    {
         if (lastMapping != null)
         {
             FilePosition sourceStartPosition = lastMapping.sourceStartPosition;
@@ -547,8 +555,6 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
             }
             return;
         }
-        int sourceLine = node.getLine();
-        int sourceColumn = node.getColumn() + startOffset;
         
         String nodeName = null;
         if (nameStack.size() > 0)
@@ -558,7 +564,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         SourceMapMapping mapping = new SourceMapMapping();
         mapping.sourcePath = sourcePath;
         mapping.name = nodeName;
-        mapping.sourceStartPosition = new FilePosition(sourceLine, sourceColumn);
+        mapping.sourceStartPosition = new FilePosition(line, column);
         mapping.destStartPosition = new FilePosition(getCurrentLine(), getCurrentColumn());
         lastMapping = mapping;
     }


[38/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - MXMLWriter: fix for exception caused by change in JSWriter writeTo() signature

Posted by cd...@apache.org.
MXMLWriter: fix for exception caused by change in JSWriter writeTo() signature


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

Branch: refs/heads/feature/maven-migration
Commit: 5fc4bfc9ae313f15f5672e6990ef17e8d5deb127
Parents: bdc933e
Author: Josh Tynjala <jo...@apache.org>
Authored: Thu Apr 7 16:04:45 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Thu Apr 7 16:04:45 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/JSWriter.java  |  3 +--
 .../internal/codegen/mxml/MXMLWriter.java       | 24 ++++++++++++--------
 2 files changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5fc4bfc9/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSWriter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSWriter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSWriter.java
index 0e60a93..e984eda 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSWriter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSWriter.java
@@ -103,7 +103,6 @@ public class JSWriter implements IJSWriter
         if (sourceMapOut != null)
         {
             convertMappingSourcePathsToRelative(emitter, sourceMapOut);
-            
 
             File compilationUnitFile = new File(compilationUnit.getAbsoluteFilename());
             ISourceMapEmitter sourceMapEmitter = backend.createSourceMapEmitter(emitter);
@@ -123,7 +122,7 @@ public class JSWriter implements IJSWriter
         }
     }
     
-    private void convertMappingSourcePathsToRelative(IJSEmitter emitter, File relativeToFile)
+    protected void convertMappingSourcePathsToRelative(IJSEmitter emitter, File relativeToFile)
     {
         List<IJSEmitter.SourceMapMapping> mappings = emitter.getSourceMapMappings();
         for (IJSEmitter.SourceMapMapping mapping : mappings)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/5fc4bfc9/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java
index 81ce78c..afb45fd 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLWriter.java
@@ -19,12 +19,14 @@
 
 package org.apache.flex.compiler.internal.codegen.mxml;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
 
-import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
 import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
+import org.apache.flex.compiler.driver.js.IJSBackend;
 import org.apache.flex.compiler.internal.codegen.js.JSFilterWriter;
 import org.apache.flex.compiler.internal.codegen.js.JSSharedData;
 import org.apache.flex.compiler.internal.codegen.js.JSWriter;
@@ -49,18 +51,17 @@ public class MXMLWriter extends JSWriter
     }
 
     @Override
-    public void writeTo(OutputStream out)
+    public void writeTo(OutputStream out, File sourceMapOut)
     {
-        JSFilterWriter writer = (JSFilterWriter) JSSharedData.backend
-                .createWriterBuffer(project);
+        IJSBackend backend = (IJSBackend) JSSharedData.backend;
+        JSFilterWriter writer = (JSFilterWriter) backend.createWriterBuffer(project);
 
-        IASEmitter asEmitter = JSSharedData.backend.createEmitter(writer);
-        IASBlockWalker asBlockWalker = JSSharedData.backend.createWalker(
+        IJSEmitter asEmitter = (IJSEmitter) backend.createEmitter(writer);
+        IASBlockWalker asBlockWalker = backend.createWalker(
                 project, problems, asEmitter);
 
-        IMXMLEmitter mxmlEmitter = JSSharedData.backend
-                .createMXMLEmitter(writer);
-        IMXMLBlockWalker mxmlBlockWalker = JSSharedData.backend.createMXMLWalker(
+        IMXMLEmitter mxmlEmitter = backend.createMXMLEmitter(writer);
+        IMXMLBlockWalker mxmlBlockWalker = backend.createMXMLWalker(
                 project, problems, mxmlEmitter, asEmitter, asBlockWalker);
 
         mxmlBlockWalker.visitCompilationUnit(compilationUnit);
@@ -73,6 +74,11 @@ public class MXMLWriter extends JSWriter
         {
             e.printStackTrace();
         }
+
+        if (sourceMapOut != null)
+        {
+            throw new UnsupportedOperationException("Source maps not supported for MXML files");
+        }
     }
 
 }


[13/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - emit source map for ternary operator

Posted by cd...@apache.org.
emit source map for ternary operator


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

Branch: refs/heads/feature/maven-migration
Commit: e89e3756db4d404d8ecface3e252a10f46c37909
Parents: 673e088
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Mar 30 15:09:34 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Mar 30 15:09:34 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/JSEmitter.java | 31 ++++++++++++++++++++
 1 file changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/e89e3756/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index 72ceae9..aae2cfd 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -49,15 +49,18 @@ import org.apache.flex.compiler.tree.as.ILiteralContainerNode;
 import org.apache.flex.compiler.tree.as.ILiteralNode;
 import org.apache.flex.compiler.tree.as.INumericLiteralNode;
 import org.apache.flex.compiler.tree.as.IObjectLiteralValuePairNode;
+import org.apache.flex.compiler.tree.as.IOperatorNode;
 import org.apache.flex.compiler.tree.as.IPackageNode;
 import org.apache.flex.compiler.tree.as.IParameterNode;
 import org.apache.flex.compiler.tree.as.IReturnNode;
 import org.apache.flex.compiler.tree.as.ITerminalNode;
+import org.apache.flex.compiler.tree.as.ITernaryOperatorNode;
 import org.apache.flex.compiler.tree.as.ITypeNode;
 import org.apache.flex.compiler.tree.as.ITypedExpressionNode;
 import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;
 import org.apache.flex.compiler.tree.as.IWhileLoopNode;
+import org.apache.flex.compiler.utils.ASNodeUtils;
 import org.apache.flex.compiler.visitor.IBlockWalker;
 
 import com.google.debugging.sourcemap.FilePosition;
@@ -374,6 +377,34 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     }
 
     @Override
+    public void emitTernaryOperator(ITernaryOperatorNode node)
+    {
+        if (ASNodeUtils.hasParenOpen((IOperatorNode) node))
+            write(ASEmitterTokens.PAREN_OPEN);
+        
+        IExpressionNode conditionalNode = node.getConditionalNode();
+        getWalker().walk(conditionalNode);
+        
+        startMapping(node, conditionalNode.getAbsoluteEnd() - node.getAbsoluteStart());
+        write(ASEmitterTokens.SPACE);
+        writeToken(ASEmitterTokens.TERNARY);
+        endMapping(node);
+        
+        IExpressionNode leftOperandNode = node.getLeftOperandNode();
+        getWalker().walk(leftOperandNode);
+
+        startMapping(node, leftOperandNode.getAbsoluteEnd() - node.getAbsoluteStart());
+        write(ASEmitterTokens.SPACE);
+        writeToken(ASEmitterTokens.COLON);
+        endMapping(node);
+        
+        getWalker().walk(node.getRightOperandNode());
+        
+        if (ASNodeUtils.hasParenClose((IOperatorNode) node))
+            write(ASEmitterTokens.PAREN_CLOSE);
+    }
+
+    @Override
     public void emitWhileLoop(IWhileLoopNode node)
     {
         IContainerNode cnode = (IContainerNode) node.getChild(1);


[04/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - FunctionCallEmitter: source map includes Language into calls that require it

Posted by cd...@apache.org.
FunctionCallEmitter: source map includes Language into calls that require it


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

Branch: refs/heads/feature/maven-migration
Commit: 2a40650e34056ffdd08d79da1dd24e9e682c7ea3
Parents: 5e8e9cb
Author: Josh Tynjala <jo...@apache.org>
Authored: Tue Mar 29 15:44:34 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Tue Mar 29 15:44:34 2016 -0700

----------------------------------------------------------------------
 .../flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java  | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2a40650e/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
index 9c4d225..ab36794 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java
@@ -146,10 +146,12 @@ public class FunctionCallEmitter extends JSSubEmitter implements ISubEmitter<IFu
                         ICompilerProject project = this.getProject();
                         if (project instanceof FlexJSProject)
                             ((FlexJSProject) project).needLanguage = true;
+                        getEmitter().startMapping(node.getNameNode());
                         write(JSFlexJSEmitterTokens.LANGUAGE_QNAME);
                         write(ASEmitterTokens.MEMBER_ACCESS);
                         if (isInt)
                             write(JSFlexJSEmitterTokens.UNDERSCORE);
+                        getEmitter().endMapping(node.getNameNode());
                     }
                     else if (def instanceof AppliedVectorDefinition)
                     {


[36/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - changes to get XML in the requires

Posted by cd...@apache.org.
changes to get XML in the requires


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

Branch: refs/heads/feature/maven-migration
Commit: 6c6584da5be8ab5c4df0012110479b4d7d336a8b
Parents: 88a9bc2
Author: Alex Harui <ah...@apache.org>
Authored: Thu Apr 7 10:39:28 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Apr 7 10:42:59 2016 -0700

----------------------------------------------------------------------
 .../js/flexjs/TestFlexJSGlobalClasses.java      |  1 +
 .../codegen/js/flexjs/TestFlexJSProject.java    | 15 +++
 .../flex/compiler/internal/test/TestBase.java   | 98 ++++++++++++++------
 .../flexjs/projects/interfaces/Test_result.js   |  1 +
 .../flexjs/projects/super/Base_result.js        |  1 +
 .../flexjs/projects/xml_requires/XMLRequire.as  | 30 ++++++
 .../projects/xml_requires/XMLRequire_result.js  | 74 +++++++++++++++
 .../codegen/js/jx/PackageHeaderEmitter.java     |  2 +-
 .../mxml/flexjs/MXMLFlexJSPublisher.java        | 71 ++++++++++++++
 .../internal/projects/FlexJSProject.java        |  5 +
 compiler.tests/.classpath                       |  1 +
 11 files changed, 270 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6c6584da/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
index df663af..32f28f5 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSGlobalClasses.java
@@ -27,6 +27,7 @@ import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.tree.as.VariableNode;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IFileNode;
 import org.apache.flex.compiler.tree.as.IForLoopNode;
 import org.apache.flex.compiler.tree.as.IFunctionCallNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6c6584da/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
index fec0d2f..c057f92 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java
@@ -131,6 +131,21 @@ public class TestFlexJSProject extends TestGoogProject
     }
 
     @Test
+    public void test_XMLRequires()
+    {
+        String testDirPath = projectDirPath + "/xml_requires";
+
+        String fileName = "XMLRequire";
+
+        sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(),
+                projectDirPath + "/xml_requires").getPath();
+
+        List<String> compiledFileNames = compileProject(fileName, testDirPath);
+
+        assertProjectOut(compiledFileNames, testDirPath);
+    }
+
+    @Test
     public void test_Overrides()
     {
         String testDirPath = projectDirPath + "/overrides";

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6c6584da/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
index 186f690..d8d6e36 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/TestBase.java
@@ -40,6 +40,7 @@ import java.util.List;
 import org.apache.flex.compiler.codegen.as.IASEmitter;
 import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
 import org.apache.flex.compiler.config.Configurator;
+import org.apache.flex.compiler.constants.IASLanguageConstants;
 import org.apache.flex.compiler.driver.IBackend;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.as.ASFilterWriter;
@@ -350,7 +351,7 @@ public class TestBase implements ITestBase
 			qname = mainCU.getQualifiedNames().get(0);
 	        final File outputClassFile = getOutputClassFile(qname
 	                + "_output", outputRootDir);
-	        appendLanguage(outputClassFile.getAbsolutePath(), qname);
+	        appendLanguageAndXML(outputClassFile.getAbsolutePath(), qname);
 		} catch (InterruptedException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
@@ -374,34 +375,75 @@ public class TestBase implements ITestBase
 		fw.close();
 	}
     
-    private void appendLanguage(String path, String projectName)
-	throws IOException
-	{
-		StringBuilder appendString = new StringBuilder();
-		appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-		appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
-		appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-		appendString.append(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
-		appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
-		appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
-		appendString.append(ASEmitterTokens.SEMICOLON.getToken());
-		
-	    String fileData = readCode(new File(path));
-	    int reqidx = fileData.indexOf(appendString.toString());
-
+    private void appendLanguageAndXML(String path, String projectName) throws IOException
+    {
+        StringBuilder appendString = new StringBuilder();
+        appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+        appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
+        appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+        appendString.append(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
+        appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+        appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
+        appendString.append(ASEmitterTokens.SEMICOLON.getToken());
+        appendString.append("\n");
+
+        String fileData = readCode(new File(path));
+        int reqidx = fileData.indexOf(appendString.toString());
 	    if (reqidx == -1 && project instanceof FlexJSProject && ((FlexJSProject)project).needLanguage)
-	    {
-	    	reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-	    	if (reqidx == -1)
-	    		reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken());
-	    	reqidx = fileData.indexOf(";", reqidx);
-		    String after = fileData.substring(reqidx + 1);
-		    String before = fileData.substring(0, reqidx + 1);
-		    String s = before + "\n" + appendString.toString() + after;
-		    writeFile(path, s, false);
-	    }
-	}
-	
+        {
+	    	boolean afterProvide = false;
+            reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+            if (reqidx == -1)
+            {
+            	afterProvide = true;
+                reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken());
+            }
+            reqidx = fileData.indexOf(";", reqidx);
+            String after = fileData.substring(reqidx + 1);
+            String before = fileData.substring(0, reqidx + 1);
+            if (afterProvide)
+            	before += "\n";
+            String s = before + "\n" + appendString.toString() + after;
+            writeFile(path, s, false);
+        }
+        
+        StringBuilder appendStringXML = new StringBuilder();
+        appendStringXML.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+        appendStringXML.append(ASEmitterTokens.PAREN_OPEN.getToken());
+        appendStringXML.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+        appendStringXML.append(IASLanguageConstants.XML);
+        appendStringXML.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+        appendStringXML.append(ASEmitterTokens.PAREN_CLOSE.getToken());
+        appendStringXML.append(ASEmitterTokens.SEMICOLON.getToken());
+        appendStringXML.append("\n");
+
+        if (project instanceof FlexJSProject && ((FlexJSProject)project).needXML)
+        {
+	        fileData = readCode(new File(path));
+	        reqidx = fileData.indexOf(appendStringXML.toString());
+	        if (reqidx == -1)
+	        {
+		    	boolean afterProvide = false;
+	            reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+	            if (reqidx == -1)
+	            {
+	            	afterProvide = true;
+	                reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken());
+	            }
+	            reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+	            if (reqidx == -1)
+	                reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken());
+	            reqidx = fileData.indexOf(";", reqidx);
+	            String after = fileData.substring(reqidx + 1);
+	            String before = fileData.substring(0, reqidx + 1);
+	            if (afterProvide)
+	            	before += "\n";
+	            String s = before + "\n" + appendStringXML.toString() + after;
+	            writeFile(path, s, false);
+	        }
+        }
+    }
+
 	protected String readCode(File file)
 	{
 	    String code = "";

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6c6584da/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js b/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js
index 42ab0f4..92bb29f 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js
@@ -29,6 +29,7 @@ goog.require('org.apache.flex.utils.Language');
 
 
 
+
 /**
  * @constructor
  * @extends {classes.A}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6c6584da/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js b/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
index 1306674..db3ade9 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
@@ -26,6 +26,7 @@ goog.require('org.apache.flex.utils.Language');
 
 
 
+
 /**
  * @constructor
  * @extends {Super}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6c6584da/compiler.jx.tests/test-files/flexjs/projects/xml_requires/XMLRequire.as
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/xml_requires/XMLRequire.as b/compiler.jx.tests/test-files/flexjs/projects/xml_requires/XMLRequire.as
new file mode 100644
index 0000000..4a997c9
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/projects/xml_requires/XMLRequire.as
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+	
+	public class XMLRequire
+	{
+		public function XMLRequire() 
+        {
+            var myXML:XML = <node />;		
+        }		
+	}
+	
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6c6584da/compiler.jx.tests/test-files/flexjs/projects/xml_requires/XMLRequire_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/xml_requires/XMLRequire_result.js b/compiler.jx.tests/test-files/flexjs/projects/xml_requires/XMLRequire_result.js
new file mode 100644
index 0000000..d6affbe
--- /dev/null
+++ b/compiler.jx.tests/test-files/flexjs/projects/xml_requires/XMLRequire_result.js
@@ -0,0 +1,74 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * XMLRequire
+ *
+ * @fileoverview
+ *
+ * @suppress {checkTypes|accessControls}
+ */
+
+goog.provide('XMLRequire');
+
+goog.require('XML');
+
+
+
+
+
+/**
+ * @constructor
+ */
+XMLRequire = function() {
+  var /** @type {XML} */ myXML = new XML( '<node />') ;
+};
+
+
+/**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+XMLRequire.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'XMLRequire', qName: 'XMLRequire'}] };
+
+
+/**
+ * Prevent renaming of class. Needed for reflection.
+ */
+goog.exportSymbol('XMLRequire', XMLRequire);
+
+
+
+/**
+ * Reflection
+ *
+ * @return {Object.<string, Function>}
+ */
+XMLRequire.prototype.FLEXJS_REFLECTION_INFO = function () {
+  return {
+    variables: function () {
+      return {
+      };
+    },
+    accessors: function () {
+      return {
+      };
+    },
+    methods: function () {
+      return {
+        'XMLRequire': { type: '', declaredBy: 'XMLRequire'}
+      };
+    }
+  };
+};

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6c6584da/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
index 48acf5b..d47c6dc 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
@@ -208,7 +208,7 @@ public class PackageHeaderEmitter extends JSSubEmitter implements
 
                 if (NativeUtils.isNative(imp))
                 {
-                	if (!(imp.equals("QName") || imp.equals("Namespace")))
+                	if (!(imp.equals("QName") || imp.equals("Namespace") || imp.equals("XML") || imp.equals("XMLList")))
                 		continue;                	
                 }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6c6584da/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 347e01c..4dcc1be 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -42,6 +42,7 @@ import org.apache.commons.io.filefilter.RegexFileFilter;
 import org.apache.flex.compiler.clients.problems.ProblemQuery;
 import org.apache.flex.compiler.codegen.js.IJSPublisher;
 import org.apache.flex.compiler.config.Configuration;
+import org.apache.flex.compiler.constants.IASLanguageConstants;
 import org.apache.flex.compiler.css.ICSSPropertyValue;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.JSSharedData;
@@ -278,6 +279,7 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
 
         appendExportSymbol(projectIntermediateJSFilePath, projectName);
         appendEncodedCSS(projectIntermediateJSFilePath, projectName);
+        appendLanguageAndXML(projectIntermediateJSFilePath, projectName);
 
         // if (!subsetGoog)
         // {
@@ -525,6 +527,75 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher
         }
     }
 
+    private void appendLanguageAndXML(String path, String projectName) throws IOException
+    {
+        StringBuilder appendString = new StringBuilder();
+        appendString.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+        appendString.append(ASEmitterTokens.PAREN_OPEN.getToken());
+        appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+        appendString.append(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken());
+        appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+        appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
+        appendString.append(ASEmitterTokens.SEMICOLON.getToken());
+        appendString.append("\n");
+
+        String fileData = readCode(new File(path));
+        int reqidx = fileData.indexOf(appendString.toString());
+        if (reqidx == -1 && project.needLanguage)
+        {
+	    	boolean afterProvide = false;
+            reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+            if (reqidx == -1)
+            {
+            	afterProvide = true;
+                reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken());
+            }
+            reqidx = fileData.indexOf(";", reqidx);
+            String after = fileData.substring(reqidx + 1);
+            String before = fileData.substring(0, reqidx + 1);
+            if (afterProvide)
+            	before += "\n";
+            String s = before + "\n" + appendString.toString() + after;
+            writeFile(path, s, false);
+        }
+        
+        StringBuilder appendStringXML = new StringBuilder();
+        appendStringXML.append(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+        appendStringXML.append(ASEmitterTokens.PAREN_OPEN.getToken());
+        appendStringXML.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+        appendStringXML.append(IASLanguageConstants.XML);
+        appendStringXML.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
+        appendStringXML.append(ASEmitterTokens.PAREN_CLOSE.getToken());
+        appendStringXML.append(ASEmitterTokens.SEMICOLON.getToken());
+        appendStringXML.append("\n");
+
+        if (project.needXML)
+        {
+	        fileData = readCode(new File(path));
+	        reqidx = fileData.indexOf(appendStringXML.toString());
+	        if (reqidx == -1)
+	        {
+		    	boolean afterProvide = false;
+	            reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+	            if (reqidx == -1)
+	            {
+	            	afterProvide = true;
+	                reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken());
+	            }
+	            reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+	            if (reqidx == -1)
+	                reqidx = fileData.lastIndexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken());
+	            reqidx = fileData.indexOf(";", reqidx);
+	            String after = fileData.substring(reqidx + 1);
+	            String before = fileData.substring(0, reqidx + 1);
+	            if (afterProvide)
+	            	before += "\n";
+	            String s = before + "\n" + appendStringXML.toString() + after;
+	            writeFile(path, s, false);
+	        }
+        }
+    }
+
     protected String readCode(File file)
     {
         String code = "";

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6c6584da/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
index a1098a7..67869ab 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
@@ -101,7 +101,11 @@ public class FlexJSProject extends FlexProject
                     }
                 }
                 else if (!isExternalLinkage(to) || qname.equals("Namespace"))
+                {
+                	if (qname.equals("XML"))
+                		needXML = true;
                     reqs.put(qname, dt);
+                }
             }
         }
         else
@@ -134,6 +138,7 @@ public class FlexJSProject extends FlexProject
 
     public boolean needLanguage;
     public boolean needCSS;
+    public boolean needXML;
     
     private LinkageChecker linkageChecker;
     private ITargetSettings ts;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6c6584da/compiler.tests/.classpath
----------------------------------------------------------------------
diff --git a/compiler.tests/.classpath b/compiler.tests/.classpath
index c8aaecc..7508ebe 100644
--- a/compiler.tests/.classpath
+++ b/compiler.tests/.classpath
@@ -9,5 +9,6 @@
 	<classpathentry kind="lib" path="/compiler/lib/commons-io.jar"/>
 	<classpathentry kind="src" path="/compiler"/>
 	<classpathentry kind="lib" path="/compiler/lib/guava.jar"/>
+	<classpathentry kind="lib" path="/compiler.tests/lib/commons-compress-1.10.jar"/>
 	<classpathentry kind="output" path="classes"/>
 </classpath>


[25/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - IJSEmitter: replaced startMapping() that takes a column offset with one that takes prev/next nodes so that the entire space can be filled (even across multiple lines)

Posted by cd...@apache.org.
IJSEmitter: replaced startMapping() that takes a column offset with one that takes prev/next nodes so that the entire space can be filled (even across multiple lines)


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

Branch: refs/heads/feature/maven-migration
Commit: 739bef79dd9c2de5e2820c7ec191e27fe7263588
Parents: 799f906
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 1 17:01:47 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 1 17:01:47 2016 -0700

----------------------------------------------------------------------
 .../flex/compiler/codegen/js/IJSEmitter.java    | 23 +++++++--
 .../compiler/internal/codegen/js/JSEmitter.java | 52 ++++++++++----------
 .../internal/codegen/js/jx/AsIsEmitter.java     |  6 +--
 .../codegen/js/jx/BinaryOperatorEmitter.java    |  6 +--
 .../codegen/js/jx/MemberAccessEmitter.java      |  2 +-
 .../codegen/js/jx/VarDeclarationEmitter.java    | 25 +++++++---
 6 files changed, 71 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/739bef79/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
index 56a0c05..d42abe1 100644
--- a/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/codegen/js/IJSEmitter.java
@@ -43,13 +43,30 @@ public interface IJSEmitter extends IASEmitter
     List<SourceMapMapping> getSourceMapMappings();
     
     String formatQualifiedName(String name);
-    
+
+    /**
+     * Adds a node to the source map.
+     */
     void startMapping(ISourceLocation node);
-    void startMapping(ISourceLocation node, int startOffset);
+
+    /**
+     * Adds a node to the source map using custom line and column values,
+     * instead of the node's own line and column. Useful for starting a mapping
+     * in the middle of the node.
+     */
     void startMapping(ISourceLocation node, int line, int column);
+
+    /**
+     * Adds a node to the source map using the space between two nodes instead
+     * of the node's own line and column.
+     */
     void startMapping(ISourceLocation node, ISourceLocation previousNode, ISourceLocation nextNode);
-    
+
+    /**
+     * Commits a mapping to the source map.
+     */
     void endMapping(ISourceLocation node);
+
     void pushSourceMapName(ISourceLocation node);
     void popSourceMapName();
     

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/739bef79/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index 71c7d6e..ba7cbdf 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -183,7 +183,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
             }
         }
 
-        startMapping(node, node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
+        startMapping(node, node.getLine(), node.getColumn() + node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
         write(ASEmitterTokens.PAREN_CLOSE);
         endMapping(node);
     }
@@ -220,7 +220,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
             }
         }
 
-        startMapping(node, node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
+        startMapping(node, node.getLine(), node.getColumn() + node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
         write(ASEmitterTokens.PAREN_CLOSE);
         endMapping(node);
     }
@@ -286,7 +286,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
 
         if (postFix != null)
         {
-            startMapping(node, node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
+            startMapping(node, node.getLine(), node.getColumn() + node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
             write(postFix);
             endMapping(node);
         }
@@ -308,11 +308,12 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
             endMapping(nameNode);
         }
         
-        startMapping(sourceLocationNode, nameNode.getAbsoluteEnd() - sourceLocationNode.getAbsoluteStart());
+        IExpressionNode valueNode = node.getValueNode();
+        startMapping(sourceLocationNode, nameNode, valueNode);
         write(ASEmitterTokens.COLON);
         endMapping(sourceLocationNode);
         
-        getWalker().walk(node.getValueNode());
+        getWalker().walk(valueNode);
     }
 
     @Override
@@ -406,10 +407,10 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         
         IASNode conditionalExpression = node.getChild(0);
         getWalker().walk(conditionalExpression);
-        
-        startMapping(node, conditionalExpression.getAbsoluteEnd() - node.getAbsoluteStart());
-        write(ASEmitterTokens.PAREN_CLOSE);
+
         IContainerNode xnode = (IContainerNode) node.getStatementContentsNode();
+        startMapping(node, conditionalExpression, xnode);
+        write(ASEmitterTokens.PAREN_CLOSE);
         if (!isImplicit(xnode))
             write(ASEmitterTokens.SPACE);
         endMapping(node);
@@ -446,21 +447,22 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         
         IExpressionNode conditionalNode = node.getConditionalNode();
         getWalker().walk(conditionalNode);
-        
-        startMapping(node, conditionalNode.getAbsoluteEnd() - node.getAbsoluteStart());
+
+        IExpressionNode leftOperandNode = node.getLeftOperandNode();
+        startMapping(node, conditionalNode, leftOperandNode);
         write(ASEmitterTokens.SPACE);
         writeToken(ASEmitterTokens.TERNARY);
         endMapping(node);
         
-        IExpressionNode leftOperandNode = node.getLeftOperandNode();
         getWalker().walk(leftOperandNode);
 
-        startMapping(node, leftOperandNode.getAbsoluteEnd() - node.getAbsoluteStart());
+        IExpressionNode rightOperandNode = node.getRightOperandNode();
+        startMapping(node, leftOperandNode, rightOperandNode);
         write(ASEmitterTokens.SPACE);
         writeToken(ASEmitterTokens.COLON);
         endMapping(node);
         
-        getWalker().walk(node.getRightOperandNode());
+        getWalker().walk(rightOperandNode);
         
         if (ASNodeUtils.hasParenClose((IOperatorNode) node))
             write(ASEmitterTokens.PAREN_CLOSE);
@@ -478,14 +480,15 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
 
         IASNode conditionalExpression = node.getConditionalExpressionNode();
         getWalker().walk(conditionalExpression);
-        
-        startMapping(node, conditionalExpression.getAbsoluteEnd() - node.getAbsoluteStart());
+
+        IASNode statementContentsNode = node.getStatementContentsNode();
+        startMapping(node, conditionalExpression, statementContentsNode);
         write(ASEmitterTokens.PAREN_CLOSE);
         if (!isImplicit(cnode))
             write(ASEmitterTokens.SPACE);
         endMapping(node);
         
-        getWalker().walk(node.getStatementContentsNode());
+        getWalker().walk(statementContentsNode);
     }
 
     @Override
@@ -501,8 +504,9 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
 
         IASNode statementContents = node.getStatementContentsNode();
         getWalker().walk(statementContents);
-        
-        startMapping(node, statementContents.getAbsoluteEnd() - statementContents.getAbsoluteStart());
+
+        IASNode conditionalExpressionNode = node.getConditionalExpressionNode();
+        startMapping(node, statementContents, conditionalExpressionNode);
         if (!isImplicit(cnode))
             write(ASEmitterTokens.SPACE);
         else
@@ -512,10 +516,9 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         write(ASEmitterTokens.PAREN_OPEN);
         endMapping(node);
 
-        IASNode conditionalExpression = node.getConditionalExpressionNode();
-        getWalker().walk(conditionalExpression);
+        getWalker().walk(conditionalExpressionNode);
         
-        startMapping(node, conditionalExpression.getAbsoluteEnd() - node.getAbsoluteStart());
+        startMapping(node, conditionalExpressionNode, conditionalExpressionNode.getSucceedingNode(1));
         write(ASEmitterTokens.PAREN_CLOSE);
         write(ASEmitterTokens.SEMICOLON);
         endMapping(node);
@@ -536,7 +539,7 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     {
         IExpressionNode operandNode = node.getOperandNode();
         getWalker().walk(operandNode);
-        startMapping(node, operandNode.getAbsoluteEnd() - operandNode.getAbsoluteStart());
+        startMapping(node, operandNode.getLine(), operandNode.getColumn() + operandNode.getAbsoluteEnd() - operandNode.getAbsoluteStart());
         write(node.getOperator().getOperatorText());
         endMapping(node);
     }
@@ -635,11 +638,6 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         startMapping(node, node.getLine(), node.getColumn());
     }
 
-    public void startMapping(ISourceLocation node, int startOffset)
-    {
-        startMapping(node, node.getLine(), node.getColumn() + startOffset);
-    }
-
     public void startMapping(ISourceLocation node, ISourceLocation previousNode, ISourceLocation nextNode)
     {
         if(previousNode.getLine() == nextNode.getLine())

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/739bef79/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
index 1557b7e..18c2e05 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/AsIsEmitter.java
@@ -136,7 +136,7 @@ public class AsIsEmitter extends JSSubEmitter
         if (node instanceof IBinaryOperatorNode)
         {
             IBinaryOperatorNode binaryOperatorNode = (IBinaryOperatorNode) node; 
-            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode().getEnd() - binaryOperatorNode.getLeftOperandNode().getStart());
+            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode(), binaryOperatorNode.getRightOperandNode());
         }
         else
         {
@@ -157,7 +157,7 @@ public class AsIsEmitter extends JSSubEmitter
         if (node instanceof IBinaryOperatorNode)
         {
             IBinaryOperatorNode binaryOperatorNode = (IBinaryOperatorNode) node;
-            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode().getEnd() - binaryOperatorNode.getLeftOperandNode().getStart());
+            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode(), binaryOperatorNode.getRightOperandNode());
         }
         else
         {
@@ -180,7 +180,7 @@ public class AsIsEmitter extends JSSubEmitter
         if (node instanceof IBinaryOperatorNode)
         {
             IBinaryOperatorNode binaryOperatorNode = (IBinaryOperatorNode) node;
-            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode().getEnd() - binaryOperatorNode.getLeftOperandNode().getStart());
+            getEmitter().startMapping(node, binaryOperatorNode.getLeftOperandNode(), binaryOperatorNode.getRightOperandNode());
         }
         else
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/739bef79/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
index 704c06b..b056177 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/BinaryOperatorEmitter.java
@@ -71,7 +71,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
         {
             getWalker().walk(node.getLeftOperandNode());
 
-            getEmitter().startMapping(node, node.getLeftOperandNode().getAbsoluteEnd() - node.getAbsoluteStart());
+            getEmitter().startMapping(node, node.getLeftOperandNode(), node.getRightOperandNode());
             write(ASEmitterTokens.SPACE);
             writeToken(ASEmitterTokens.INSTANCEOF);
             getEmitter().endMapping(node);
@@ -330,7 +330,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
         {
             getWalker().walk(node.getLeftOperandNode());
 
-            getEmitter().startMapping(node, node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+            getEmitter().startMapping(node, node.getLeftOperandNode(), node.getRightOperandNode());
             
             if (id != ASTNodeID.Op_CommaID)
                 write(ASEmitterTokens.SPACE);
@@ -346,7 +346,7 @@ public class BinaryOperatorEmitter extends JSSubEmitter implements
                 getEmitter().endMapping(node);
                 write(lnode.getName());
 
-                getEmitter().startMapping(node, node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+                getEmitter().startMapping(node, node.getLeftOperandNode(), node.getRightOperandNode());
                 write(ASEmitterTokens.SPACE);
                 write((id == ASTNodeID.Op_LogicalAndAssignID) ? ASEmitterTokens.LOGICAL_AND
                         : ASEmitterTokens.LOGICAL_OR);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/739bef79/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
index 245ae98..e5f9a58 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberAccessEmitter.java
@@ -246,7 +246,7 @@ public class MemberAccessEmitter extends JSSubEmitter implements
         	continueWalk = writeLeftSide(node, leftNode, rightNode);
             if (continueWalk)
             {
-                getEmitter().startMapping(node, node.getLeftOperandNode().getAbsoluteEnd() - node.getAbsoluteStart());
+                getEmitter().startMapping(node, node.getLeftOperandNode(), node.getRightOperandNode());
                 write(node.getOperator().getOperatorText());
                 getEmitter().endMapping(node);
             }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/739bef79/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
index 0cbb60a..aed9671 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
@@ -53,10 +53,23 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
             fjs.emitMemberKeyword(node);
         }
 
-        //we could use getVariableTypeNode(), but it might not have a line
-        //and column. this can happen when the type is omitted in the code
-        //and the compiler generates a node for type *
-        getEmitter().startMapping(node, node.getNameExpressionNode().getAbsoluteEnd() - node.getAbsoluteStart());
+        IExpressionNode variableTypeNode = node.getVariableTypeNode();
+        if(variableTypeNode.getLine() >= 0)
+        {
+            getEmitter().startMapping(variableTypeNode,
+                    variableTypeNode.getLine(),
+                    variableTypeNode.getColumn() - 1); //include the :
+        }
+        else
+        {
+            //the result of getVariableTypeNode() may not have a line and
+            //column. this can happen when the type is omitted in the code, and
+            //the compiler generates a node for type *.
+            //in this case, put it at the end of the name expression.
+            IExpressionNode nameExpressionNode = node.getNameExpressionNode();
+            getEmitter().startMapping(variableTypeNode, nameExpressionNode.getLine(),
+                    nameExpressionNode.getColumn() + nameExpressionNode.getAbsoluteEnd() - nameExpressionNode.getAbsoluteStart());
+        }
         IExpressionNode avnode = node.getAssignedValueNode();
         if (avnode != null)
         {
@@ -72,7 +85,7 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
         {
             fjs.getDocEmitter().emitVarDoc(node, null, getWalker().getProject());
         }
-        getEmitter().endMapping(node);
+        getEmitter().endMapping(variableTypeNode);
 
         if (!(node instanceof ChainedVariableNode) && node.isConst())
         {
@@ -82,7 +95,7 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
         fjs.emitDeclarationName(node);
         if (avnode != null && !(avnode instanceof IEmbedNode))
         {
-            getEmitter().startMapping(node, node.getVariableTypeNode().getEnd() - node.getStart());
+            getEmitter().startMapping(node, node.getVariableTypeNode(), avnode);
             write(ASEmitterTokens.SPACE);
             writeToken(ASEmitterTokens.EQUAL);
             getEmitter().endMapping(node);


[11/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - source map support for continue/break

Posted by cd...@apache.org.
source map support for continue/break


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

Branch: refs/heads/feature/maven-migration
Commit: ba21c899cd7a0be46351a6e9e7a680b7632a8c9d
Parents: 2dd2b08
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Mar 30 14:32:20 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Mar 30 14:32:20 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/js/JSEmitter.java | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ba21c899/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index 08fc599..72ceae9 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -42,6 +42,8 @@ import org.apache.flex.compiler.tree.as.IDefinitionNode;
 import org.apache.flex.compiler.tree.as.IExpressionNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
 import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
+import org.apache.flex.compiler.tree.as.IIdentifierNode;
+import org.apache.flex.compiler.tree.as.IIterationFlowNode;
 import org.apache.flex.compiler.tree.as.IKeywordNode;
 import org.apache.flex.compiler.tree.as.ILiteralContainerNode;
 import org.apache.flex.compiler.tree.as.ILiteralNode;
@@ -478,6 +480,24 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         endMapping(node);
     }
 
+    @Override
+    public void emitIterationFlow(IIterationFlowNode node)
+    {
+        startMapping(node);
+        write(node.getKind().toString().toLowerCase());
+        IIdentifierNode lnode = node.getLabelNode();
+        if (lnode != null)
+        {
+            write(ASEmitterTokens.SPACE);
+            endMapping(node);
+            getWalker().walk(lnode);
+        }
+        else
+        {
+            endMapping(node);
+        }
+    }
+
     public void pushSourceMapName(ISourceLocation node)
     {
         boolean isValidMappingScope = node instanceof ITypeNode


[12/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - ASParser: fixed issue where ] was not included in array literal node

Posted by cd...@apache.org.
ASParser: fixed issue where ] was not included in array literal node


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

Branch: refs/heads/feature/maven-migration
Commit: 673e0880e0bae289da52b62e84b7b1a2e57ab1e5
Parents: ba21c89
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Mar 30 14:33:04 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Mar 30 14:33:04 2016 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/compiler/internal/parsing/as/ASParser.g    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/673e0880/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g b/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
index c84a089..5bdbd44 100644
--- a/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
+++ b/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
@@ -2483,7 +2483,7 @@ arrayInitializer [ArrayLiteralNode node]
     }
     :   open:TOKEN_SQUARE_OPEN            { contents.startAfter(open); }
         arrayElements[contents]
-        close:TOKEN_SQUARE_CLOSE          { contents.endBefore(close); }
+        close:TOKEN_SQUARE_CLOSE          { contents.endAfter(close); }
     ;	
     exception catch [RecognitionException ex] 
     { 


[37/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - fix up tests

Posted by cd...@apache.org.
fix up tests


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

Branch: refs/heads/feature/maven-migration
Commit: bdc933e4c22be00a90790d38dace8abe80271a88
Parents: 6c6584d
Author: Alex Harui <ah...@apache.org>
Authored: Thu Apr 7 10:55:27 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Apr 7 10:55:27 2016 -0700

----------------------------------------------------------------------
 .../test-files/flexjs/projects/interfaces/Test_result.js            | 1 -
 compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js   | 1 -
 2 files changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bdc933e4/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js b/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js
index 92bb29f..42ab0f4 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/interfaces/Test_result.js
@@ -29,7 +29,6 @@ goog.require('org.apache.flex.utils.Language');
 
 
 
-
 /**
  * @constructor
  * @extends {classes.A}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bdc933e4/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js b/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
index db3ade9..1306674 100644
--- a/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
+++ b/compiler.jx.tests/test-files/flexjs/projects/super/Base_result.js
@@ -26,7 +26,6 @@ goog.require('org.apache.flex.utils.Language');
 
 
 
-
 /**
  * @constructor
  * @extends {Super}


[14/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - ASParser: object and array literals should include starting { or [

Posted by cd...@apache.org.
ASParser: object and array literals should include starting { or [


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

Branch: refs/heads/feature/maven-migration
Commit: ea51f07258b3c1d830f9f8da88ac53f3eb6e55fe
Parents: e89e375
Author: Josh Tynjala <jo...@apache.org>
Authored: Wed Mar 30 16:32:37 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Wed Mar 30 16:32:37 2016 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/compiler/internal/parsing/as/ASParser.g  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ea51f072/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g b/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
index 5bdbd44..443aaeb 100644
--- a/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
+++ b/compiler/src/org/apache/flex/compiler/internal/parsing/as/ASParser.g
@@ -2414,7 +2414,7 @@ objectLiteralExpression returns [ExpressionNodeBase n]
 	ContainerNode b = o.getContentsNode(); 
 	ExpressionNodeBase vp = null;
 }
-    :   openT:TOKEN_BLOCK_OPEN           { n.startAfter(openT); }
+    :   openT:TOKEN_BLOCK_OPEN           { n.startBefore(openT); }
         (   vp=objectLiteralValuePair    { b.addItem(vp); }
       	    (   TOKEN_COMMA vp=objectLiteralValuePair
     	        { if (vp != null) b.addItem(vp); }
@@ -2481,7 +2481,7 @@ arrayInitializer [ArrayLiteralNode node]
     {
         final ContainerNode contents = node.getContentsNode(); 
     }
-    :   open:TOKEN_SQUARE_OPEN            { contents.startAfter(open); }
+    :   open:TOKEN_SQUARE_OPEN            { contents.startBefore(open); }
         arrayElements[contents]
         close:TOKEN_SQUARE_CLOSE          { contents.endAfter(close); }
     ;	


[23/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - improvements to var declaration source maps

Posted by cd...@apache.org.
improvements to var declaration source maps


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

Branch: refs/heads/feature/maven-migration
Commit: 7e47c2de3e0d4b08ad33f02339e1c81051222e8e
Parents: 2e464ee
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 1 14:34:13 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 1 14:34:13 2016 -0700

----------------------------------------------------------------------
 .../js/sourcemaps/TestSourceMapStatements.java  | 54 ++++++++++++++++++++
 .../codegen/js/jx/VarDeclarationEmitter.java    |  9 ++--
 2 files changed, 59 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7e47c2de/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
new file mode 100644
index 0000000..edb4ed7
--- /dev/null
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
@@ -0,0 +1,54 @@
+package org.apache.flex.compiler.internal.codegen.js.sourcemaps;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.internal.test.SourceMapTestBase;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+
+import org.junit.Test;
+
+public class TestSourceMapStatements extends SourceMapTestBase
+{
+    //----------------------------------
+    // var declaration
+    //----------------------------------
+
+    @Test
+    public void testVarDeclaration()
+    {
+        IVariableNode node = (IVariableNode) getNode("var a;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        //var /** @type {*} */ a
+        assertMapping(node, 0, 0, 0, 0, 0, 4);
+        assertMapping(node, 0, 5, 0, 4, 0, 21);
+    }
+
+    @Test
+    public void testVarDeclaration_withType()
+    {
+        IVariableNode node = (IVariableNode) getNode("var a:int;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        //var /** @type {number} */ a
+        assertMapping(node, 0, 0, 0, 0, 0, 4);
+        assertMapping(node, 0, 5, 0, 4, 0, 26);
+    }
+
+    @Test
+    public void testVarDeclaration_withTypeAssignedValue()
+    {
+        IVariableNode node = (IVariableNode) getNode("var a:int = 42;",
+                IVariableNode.class);
+        asBlockWalker.visitVariable(node);
+        //var /** @type {number} */ a = 42
+        assertMapping(node, 0, 0, 0, 0, 0, 4);
+        assertMapping(node, 0, 5, 0, 4, 0, 26);
+        assertMapping(node, 0, 9, 0, 27, 0, 30);
+    }
+
+    protected IBackend createBackend()
+    {
+        return new FlexJSBackend();
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7e47c2de/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
index 3829b68..159a4f0 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
@@ -53,10 +53,13 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
             fjs.emitMemberKeyword(node);
         }
 
+        //we could use getVariableTypeNode(), but it might not have a line
+        //and column. this can happen when the type is omitted in the code
+        //and the compiler generates a node for type *
+        getEmitter().startMapping(node, node.getNameExpressionNode().getAbsoluteEnd() - node.getAbsoluteStart());
         IExpressionNode avnode = node.getAssignedValueNode();
         if (avnode != null)
         {
-            getEmitter().startMapping(node.getVariableTypeNode());
             IDefinition def = avnode.resolveType(getWalker().getProject());
 
             String opcode = avnode.getNodeID().getParaphrase();
@@ -64,14 +67,12 @@ public class VarDeclarationEmitter extends JSSubEmitter implements
             {
                 fjs.getDocEmitter().emitVarDoc(node, def, getWalker().getProject());
             }
-            getEmitter().endMapping(node.getVariableTypeNode());
         }
         else
         {
-            getEmitter().startMapping(node.getVariableTypeNode());
             fjs.getDocEmitter().emitVarDoc(node, null, getWalker().getProject());
-            getEmitter().endMapping(node.getVariableTypeNode());
         }
+        getEmitter().endMapping(node);
 
         if (!(node instanceof ChainedVariableNode) && node.isConst())
         {


[32/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - ASEmitter: reverted change to emitIf() because JSEmitter was refactored to handle this in a sub-emitter

Posted by cd...@apache.org.
ASEmitter: reverted change to emitIf() because JSEmitter was refactored to handle this in a sub-emitter


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

Branch: refs/heads/feature/maven-migration
Commit: dd409d310dd2aa136c29e479b0bd4f721c7b3b22
Parents: 6613895
Author: Josh Tynjala <jo...@apache.org>
Authored: Tue Apr 5 17:01:09 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Tue Apr 5 17:01:09 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/as/ASEmitter.java | 68 +++++++++-----------
 1 file changed, 32 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dd409d31/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 1c4036e..875d1d2 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
@@ -878,8 +878,19 @@ public class ASEmitter implements IASEmitter, IEmitter
     public void emitIf(IIfNode node)
     {
         IConditionalNode conditional = (IConditionalNode) node.getChild(0);
-        emitConditional(conditional, false);
 
+        IContainerNode xnode = (IContainerNode) conditional
+                .getStatementContentsNode();
+
+        writeToken(ASEmitterTokens.IF);
+        //write(SPACE);
+        write(ASEmitterTokens.PAREN_OPEN);
+        getWalker().walk(conditional.getChild(0)); // conditional expression
+        write(ASEmitterTokens.PAREN_CLOSE);
+        if (!isImplicit(xnode))
+            write(ASEmitterTokens.SPACE);
+
+        getWalker().walk(conditional.getChild(1)); // BlockNode
         IConditionalNode[] nodes = node.getElseIfNodes();
         if (nodes.length > 0)
         {
@@ -895,49 +906,34 @@ public class ASEmitter implements IASEmitter, IEmitter
                 else
                     write(ASEmitterTokens.SPACE);
 
-                emitConditional(enode, true);
+                writeToken(ASEmitterTokens.ELSE);
+                writeToken(ASEmitterTokens.IF);
+                write(ASEmitterTokens.PAREN_OPEN);
+                getWalker().walk(enode.getChild(0));
+                write(ASEmitterTokens.PAREN_CLOSE);
+                if (!isImplicit)
+                    write(ASEmitterTokens.SPACE);
+
+                getWalker().walk(enode.getChild(1)); // ConditionalNode
             }
         }
 
         ITerminalNode elseNode = node.getElseNode();
         if (elseNode != null)
         {
-            emitElse(elseNode);
-        }
-    }
-
-    public void emitConditional(IConditionalNode node, boolean isElseIf)
-    {
-        IContainerNode xnode = (IContainerNode) node.getStatementContentsNode();
+            IContainerNode cnode = (IContainerNode) elseNode.getChild(0);
+            // if an implicit if, add a newline with no space
+            final boolean isImplicit = isImplicit(cnode);
+            if (isImplicit)
+                writeNewline();
+            else
+                write(ASEmitterTokens.SPACE);
+            write(ASEmitterTokens.ELSE);
+            if (!isImplicit)
+                write(ASEmitterTokens.SPACE);
 
-        if (isElseIf)
-        {
-            writeToken(ASEmitterTokens.ELSE);
+            getWalker().walk(elseNode); // TerminalNode
         }
-        writeToken(ASEmitterTokens.IF);
-        write(ASEmitterTokens.PAREN_OPEN);
-        getWalker().walk(node.getChild(0)); // conditional expression
-        write(ASEmitterTokens.PAREN_CLOSE);
-        if (!isImplicit(xnode))
-            write(ASEmitterTokens.SPACE);
-
-        getWalker().walk(node.getChild(1)); // BlockNode
-    }
-    
-    public void emitElse(ITerminalNode node)
-    {
-        IContainerNode cnode = (IContainerNode) node.getChild(0);
-        // if an implicit if, add a newline with no space
-        final boolean isImplicit = isImplicit(cnode);
-        if (isImplicit)
-            writeNewline();
-        else
-            write(ASEmitterTokens.SPACE);
-        write(ASEmitterTokens.ELSE);
-        if (!isImplicit)
-            write(ASEmitterTokens.SPACE);
-
-        getWalker().walk(node); // TerminalNode
     }
 
     @Override


[27/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - JSFlexJSEmitter: fixed issue where the require for Language was omitted if no other requires exist in the main class

Posted by cd...@apache.org.
JSFlexJSEmitter: fixed issue where the require for Language was omitted if no other requires exist in the main class


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

Branch: refs/heads/feature/maven-migration
Commit: 42566284037c8921c618aea83523bbe3f222dfb2
Parents: c199920
Author: Josh Tynjala <jo...@apache.org>
Authored: Sat Apr 2 13:00:25 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Sat Apr 2 13:00:25 2016 -0700

----------------------------------------------------------------------
 .../codegen/js/flexjs/JSFlexJSEmitter.java      | 34 ++++++++++++++++----
 1 file changed, 28 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/42566284/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index c45a01c..64d3a29 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -146,14 +146,26 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
         boolean foundLanguage = false;
     	boolean sawRequires = false;
     	boolean stillSearching = true;
-    	for (int i = 0; i < lines.length; i++)
+        int addIndex = -1;
+        int len = lines.length;
+    	for (int i = 0; i < len; i++)
     	{
             String line = lines[i];
     		if (stillSearching)
     		{
-	            int c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-	            if (c > -1)
+                int c = line.indexOf(JSGoogEmitterTokens.GOOG_PROVIDE.getToken());
+                if (c != -1)
+                {
+                    // if zero requires are found, require Language after the
+                    // call to goog.provide
+                    addIndex = i + 1;
+                }
+	            c = line.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
+	            if (c != -1)
 	            {
+                    // we found other requires, so we'll just add Language at
+                    // the end of the list
+                    addIndex = -1;
 	                int c2 = line.indexOf(")");
 	                String s = line.substring(c + 14, c2 - 1);
                     if(s.equals(JSFlexJSEmitterTokens.LANGUAGE_QNAME.getToken()))
@@ -167,7 +179,7 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                         continue;
                     }
 	    		}
-	    		else if (sawRequires)
+	    		else if (sawRequires || i == len - 1)
                 {
                     stillSearching = false;
 
@@ -189,8 +201,18 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
                             appendString.append(ASEmitterTokens.SINGLE_QUOTE.getToken());
                             appendString.append(ASEmitterTokens.PAREN_CLOSE.getToken());
                             appendString.append(ASEmitterTokens.SEMICOLON.getToken());
-                            finalLines.add(appendString.toString());
-                            addLineToMappings(i);
+                            if(addIndex != -1)
+                            {
+                                // if we didn't find other requires, this index
+                                // points to the line after goog.provide
+                                finalLines.add(addIndex, appendString.toString());
+                                addLineToMappings(addIndex);
+                            }
+                            else
+                            {
+                                finalLines.add(appendString.toString());
+                                addLineToMappings(i);
+                            }
                         }
                     }
                 }


[41/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - SourceMapTestBase: better output from assertMapping() to include the passed in locations

Posted by cd...@apache.org.
SourceMapTestBase: better output from assertMapping() to include the passed in locations


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

Branch: refs/heads/feature/maven-migration
Commit: 23f83ec32d924e60b15510cdee5f452fa892c861
Parents: 9498736
Author: Josh Tynjala <jo...@apache.org>
Authored: Fri Apr 8 11:54:57 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Fri Apr 8 11:54:57 2016 -0700

----------------------------------------------------------------------
 .../apache/flex/compiler/internal/test/SourceMapTestBase.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/23f83ec3/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
index 9843267..ac58f1c 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
@@ -47,7 +47,9 @@ public class SourceMapTestBase extends ASTestBase
                 break;
             }
         }
-        assertTrue("Mapping not found for node " + node.toString(), foundMapping);
+        assertTrue("Mapping not found for node " + node.getNodeID() + ". Expected "
+                + "source: (" + nodeStartLine + ", " + nodeStartColumn + "), dest: (" + outStartLine + ", " + outStartColumn + ") to (" + outEndLine + ", " + outEndColumn + ")",
+                foundMapping);
     }
     
 }


[06/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - compiler.jx.tests: starting to test source maps

Posted by cd...@apache.org.
compiler.jx.tests: starting to test source maps


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

Branch: refs/heads/feature/maven-migration
Commit: 74cb443907cd374d4f6f77ed4e47f93b3baa942f
Parents: 1aba54f
Author: Josh Tynjala <jo...@apache.org>
Authored: Tue Mar 29 16:20:14 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Tue Mar 29 16:20:14 2016 -0700

----------------------------------------------------------------------
 .../js/sourcemaps/TestSourceMapExpressions.java | 153 +++++++++++++++++++
 .../internal/test/SourceMapTestBase.java        |  39 +++++
 2 files changed, 192 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/74cb4439/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
new file mode 100644
index 0000000..7615f25
--- /dev/null
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
@@ -0,0 +1,153 @@
+package org.apache.flex.compiler.internal.codegen.js.sourcemaps;
+
+import org.apache.flex.compiler.driver.IBackend;
+import org.apache.flex.compiler.internal.driver.js.flexjs.FlexJSBackend;
+import org.apache.flex.compiler.internal.test.SourceMapTestBase;
+import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
+import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
+
+import org.junit.Test;
+
+public class TestSourceMapExpressions extends SourceMapTestBase
+{
+    //----------------------------------
+    // Primary expression keywords
+    //----------------------------------
+
+    //----------------------------------
+    // Arithmetic
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_Plus()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a + b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_Minus()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a - b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_Divide()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a / b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_Modulo()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a % b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_Multiply()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a * b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_PostIncrement()
+    {
+        IUnaryOperatorNode node = getUnaryNode("a++");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getOperandNode().getEnd() - node.getOperandNode().getStart());
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_PreIncrement()
+    {
+        IUnaryOperatorNode node = getUnaryNode("++a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn());
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_PostDecrement()
+    {
+        IUnaryOperatorNode node = getUnaryNode("a--");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getOperandNode().getEnd() - node.getOperandNode().getStart());
+    }
+
+    @Test
+    public void testVisitUnaryOperatorNode_PreDecrement()
+    {
+        IUnaryOperatorNode node = getUnaryNode("--a");
+        asBlockWalker.visitUnaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn());
+    }
+
+    //----------------------------------
+    // Arithmetic compound assignment
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_PlusAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a += b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_MinusAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a -= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_DivideAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a /= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_ModuloAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a %= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+    }
+
+    @Test
+    public void testVisitBinaryOperatorNode_MultiplyAssignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a *= b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+    }
+
+    //----------------------------------
+    // Assignment
+    //----------------------------------
+
+    @Test
+    public void testVisitBinaryOperatorNode_Assignment()
+    {
+        IBinaryOperatorNode node = getBinaryNode("a = b");
+        asBlockWalker.visitBinaryOperator(node);
+        assertMapping(node.getLine(), node.getColumn() + node.getLeftOperandNode().getEnd() - node.getLeftOperandNode().getStart());
+    }
+
+    protected IBackend createBackend()
+    {
+        return new FlexJSBackend();
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/74cb4439/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
new file mode 100644
index 0000000..f1c1c25
--- /dev/null
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/test/SourceMapTestBase.java
@@ -0,0 +1,39 @@
+package org.apache.flex.compiler.internal.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import com.google.debugging.sourcemap.FilePosition;
+import org.apache.flex.compiler.codegen.as.IASEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+
+public class SourceMapTestBase extends ASTestBase
+{
+    protected IJSEmitter jsEmitter;
+    
+    @Override
+    public void setUp()
+    {
+        super.setUp();
+
+        jsEmitter = (IJSEmitter) asEmitter;
+    }
+
+    protected void assertMapping(int sourceStartLine, int sourceStartColumn)
+    {
+        boolean foundMapping = false;
+        List<IJSEmitter.SourceMapMapping> mappings = jsEmitter.getSourceMapMappings();
+        for (IJSEmitter.SourceMapMapping mapping : mappings)
+        {
+            FilePosition position = mapping.sourceStartPosition;
+            if(position.getLine() == sourceStartLine
+                    && position.getColumn() == sourceStartColumn)
+            {
+                foundMapping = true;
+            }
+        }
+        assertTrue(foundMapping);
+    }
+    
+}


[48/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - don't try to resolve object literal property names

Posted by cd...@apache.org.
don't try to resolve object literal property names


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

Branch: refs/heads/feature/maven-migration
Commit: 7a0a4c839f2232d7e295dbce3ecbd0a5fdb1e7f7
Parents: c054eae
Author: Alex Harui <ah...@apache.org>
Authored: Sun Apr 10 13:40:26 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Sun Apr 10 13:40:26 2016 -0700

----------------------------------------------------------------------
 .../internal/codegen/js/flexjs/TestFlexJSStatements.java  | 10 ++++++++++
 .../internal/codegen/js/jx/IdentifierEmitter.java         |  8 ++++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7a0a4c83/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java
----------------------------------------------------------------------
diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java
index 9b93226..f2022b3 100644
--- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java
+++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSStatements.java
@@ -27,6 +27,7 @@ import org.apache.flex.compiler.internal.tree.as.LabeledStatementNode;
 import org.apache.flex.compiler.tree.as.IFileNode;
 import org.apache.flex.compiler.tree.as.IForLoopNode;
 import org.apache.flex.compiler.tree.as.IIfNode;
+import org.apache.flex.compiler.tree.as.ILiteralNode;
 import org.apache.flex.compiler.tree.as.ISwitchNode;
 import org.apache.flex.compiler.tree.as.ITryNode;
 import org.apache.flex.compiler.tree.as.IVariableNode;
@@ -47,6 +48,15 @@ public class TestFlexJSStatements extends TestGoogStatements
     }
     
     @Test
+    public void testObjectListeral_withPropertyNameMatchingConst()
+    {
+        ILiteralNode node = (ILiteralNode) getNode("static const myConst:int; function falconTest_a():Object { return { myConst : myConst } }",
+        		ILiteralNode.class, WRAP_LEVEL_CLASS);
+        asBlockWalker.visitLiteral(node);
+        assertOut("{myConst:FalconTest_A.myConst}");
+    }
+    
+    @Test
     public void testVarDeclaration_withTypeAssignedStringWithNewLine()
     {
         IVariableNode node = (IVariableNode) getNode("var a:String = \"\\n\"",

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/7a0a4c83/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
index b8a9703..0d91fcf 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IdentifierEmitter.java
@@ -33,6 +33,7 @@ import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
 import org.apache.flex.compiler.internal.definitions.AccessorDefinition;
 import org.apache.flex.compiler.internal.definitions.FunctionDefinition;
 import org.apache.flex.compiler.internal.definitions.TypeDefinitionBase;
+import org.apache.flex.compiler.internal.tree.as.NonResolvingIdentifierNode;
 import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
@@ -52,6 +53,13 @@ public class IdentifierEmitter extends JSSubEmitter implements
     @Override
     public void emit(IIdentifierNode node)
     {
+    	if (node instanceof NonResolvingIdentifierNode)
+    	{
+            startMapping(node);
+    		write(node.getName());
+            endMapping(node);
+    		return;
+    	}
         IDefinition nodeDef = ((IIdentifierNode) node).resolve(getProject());
 
         IASNode parentNode = node.getParent();


[30/50] git commit: [flex-falcon] [refs/heads/feature/maven-migration] - moved overrides in JSEmitter into JSSubEmitter implementations

Posted by cd...@apache.org.
moved overrides in JSEmitter into JSSubEmitter implementations


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

Branch: refs/heads/feature/maven-migration
Commit: c3b8a2b8ccfbee3d97913a590a735091875549b0
Parents: 4256628
Author: Josh Tynjala <jo...@apache.org>
Authored: Tue Apr 5 16:35:59 2016 -0700
Committer: Josh Tynjala <jo...@apache.org>
Committed: Tue Apr 5 16:35:59 2016 -0700

----------------------------------------------------------------------
 .../compiler/internal/codegen/as/ASEmitter.java |  59 +--
 .../compiler/internal/codegen/js/JSEmitter.java | 454 +++----------------
 .../internal/codegen/js/JSSubEmitter.java       |  21 +
 .../internal/codegen/js/jx/DoWhileEmitter.java  |  71 +++
 .../codegen/js/jx/DynamicAccessEmitter.java     |  54 +++
 .../js/jx/FunctionCallArgumentsEmitter.java     |  64 +++
 .../internal/codegen/js/jx/IfEmitter.java       | 117 +++++
 .../codegen/js/jx/IterationFlowEmitter.java     |  54 +++
 .../codegen/js/jx/LiteralContainerEmitter.java  |  96 ++++
 .../codegen/js/jx/MemberKeywordEmitter.java     |  70 +++
 .../codegen/js/jx/NumericLiteralEmitter.java    |  43 ++
 .../js/jx/ObjectLiteralValuePairEmitter.java    |  62 +++
 .../codegen/js/jx/ParameterEmitter.java         |  62 +++
 .../codegen/js/jx/ParametersEmitter.java        |  64 +++
 .../internal/codegen/js/jx/ReturnEmitter.java   |  57 +++
 .../js/jx/SourceMapDirectiveEmitter.java        |  60 +++
 .../codegen/js/jx/TernaryOperatorEmitter.java   |  67 +++
 .../codegen/js/jx/UnaryOperatorEmitter.java     | 122 +++++
 .../internal/codegen/js/jx/WhileEmitter.java    |  61 +++
 .../internal/codegen/js/utils/EmitterUtils.java |   6 +
 20 files changed, 1236 insertions(+), 428 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/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 309d156..1c4036e 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
@@ -1256,8 +1256,7 @@ public class ASEmitter implements IASEmitter, IEmitter
 
     protected static final boolean isImplicit(IContainerNode node)
     {
-        return node.getContainerType() == ContainerType.IMPLICIT
-                || node.getContainerType() == ContainerType.SYNTHESIZED;
+        return EmitterUtils.isImplicit(node);
     }
 
     protected void visitForBody(IContainerNode node)
@@ -1452,63 +1451,35 @@ public class ASEmitter implements IASEmitter, IEmitter
                 || node.getNodeID() == ASTNodeID.Op_SubtractID
                 || node.getNodeID() == ASTNodeID.Op_AddID)
         {
-            emitPreUnaryOperator(node);
+            write(node.getOperator().getOperatorText());
+            IExpressionNode opNode = node.getOperandNode();
+            getWalker().walk(opNode);
         }
+
         else if (node.getNodeID() == ASTNodeID.Op_PostIncrID
                 || node.getNodeID() == ASTNodeID.Op_PostDecrID)
         {
-            emitPostUnaryOperator(node);
-        }
-        else if (node.getNodeID() == ASTNodeID.Op_DeleteID)
-        {
-            emitDeleteOperator(node);
+            getWalker().walk(node.getOperandNode());
+            write(node.getOperator().getOperatorText());
         }
-        else if (node.getNodeID() == ASTNodeID.Op_VoidID)
+        else if (node.getNodeID() == ASTNodeID.Op_DeleteID
+                || node.getNodeID() == ASTNodeID.Op_VoidID)
         {
-            emitVoidOperator(node);
+            writeToken(node.getOperator().getOperatorText());
+            getWalker().walk(node.getOperandNode());
         }
         else if (node.getNodeID() == ASTNodeID.Op_TypeOfID)
         {
-            emitTypeOfOperator(node);
+            write(node.getOperator().getOperatorText());
+            write(ASEmitterTokens.PAREN_OPEN);
+            getWalker().walk(node.getOperandNode());
+            write(ASEmitterTokens.PAREN_CLOSE);
         }
 
         if (ASNodeUtils.hasParenClose(node))
             write(ASEmitterTokens.PAREN_CLOSE);
     }
 
-    public void emitPreUnaryOperator(IUnaryOperatorNode node)
-    {
-        write(node.getOperator().getOperatorText());
-        IExpressionNode opNode = node.getOperandNode();
-        getWalker().walk(opNode);
-    }
-
-    public void emitPostUnaryOperator(IUnaryOperatorNode node)
-    {
-        getWalker().walk(node.getOperandNode());
-        write(node.getOperator().getOperatorText());
-    }
-
-    public void emitDeleteOperator(IUnaryOperatorNode node)
-    {
-        writeToken(node.getOperator().getOperatorText());
-        getWalker().walk(node.getOperandNode());
-    }
-
-    public void emitVoidOperator(IUnaryOperatorNode node)
-    {
-        writeToken(node.getOperator().getOperatorText());
-        getWalker().walk(node.getOperandNode());
-    }
-    
-    public void emitTypeOfOperator(IUnaryOperatorNode node)
-    {
-        write(node.getOperator().getOperatorText());
-        write(ASEmitterTokens.PAREN_OPEN);
-        getWalker().walk(node.getOperandNode());
-        write(ASEmitterTokens.PAREN_CLOSE);
-    }
-
     @Override
     public void emitLanguageIdentifier(ILanguageIdentifierNode node)
     {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index 6839f9e..589cbaf 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@ -24,45 +24,49 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Stack;
 
-import org.apache.flex.compiler.clients.JSConfiguration;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
 import org.apache.flex.compiler.common.ASModifier;
 import org.apache.flex.compiler.common.ISourceLocation;
 import org.apache.flex.compiler.definitions.ITypeDefinition;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitter;
 import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.jx.DoWhileEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.DynamicAccessEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.FunctionCallArgumentsEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.IfEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.IterationFlowEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.LiteralContainerEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.MemberKeywordEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.NumericLiteralEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.ObjectLiteralValuePairEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.ParameterEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.ParametersEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.ReturnEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.SourceMapDirectiveEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.TernaryOperatorEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.UnaryOperatorEmitter;
+import org.apache.flex.compiler.internal.codegen.js.jx.WhileEmitter;
 import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
-import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
-import org.apache.flex.compiler.tree.ASTNodeID;
 import org.apache.flex.compiler.tree.as.IASNode;
-import org.apache.flex.compiler.tree.as.IConditionalNode;
 import org.apache.flex.compiler.tree.as.IContainerNode;
 import org.apache.flex.compiler.tree.as.IDefinitionNode;
 import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
-import org.apache.flex.compiler.tree.as.IExpressionNode;
 import org.apache.flex.compiler.tree.as.IFunctionNode;
 import org.apache.flex.compiler.tree.as.IFunctionObjectNode;
-import org.apache.flex.compiler.tree.as.IIdentifierNode;
+import org.apache.flex.compiler.tree.as.IIfNode;
 import org.apache.flex.compiler.tree.as.IIterationFlowNode;
-import org.apache.flex.compiler.tree.as.IKeywordNode;
 import org.apache.flex.compiler.tree.as.ILiteralContainerNode;
-import org.apache.flex.compiler.tree.as.ILiteralNode;
 import org.apache.flex.compiler.tree.as.INumericLiteralNode;
 import org.apache.flex.compiler.tree.as.IObjectLiteralValuePairNode;
-import org.apache.flex.compiler.tree.as.IOperatorNode;
 import org.apache.flex.compiler.tree.as.IPackageNode;
 import org.apache.flex.compiler.tree.as.IParameterNode;
 import org.apache.flex.compiler.tree.as.IReturnNode;
-import org.apache.flex.compiler.tree.as.ITerminalNode;
 import org.apache.flex.compiler.tree.as.ITernaryOperatorNode;
 import org.apache.flex.compiler.tree.as.ITypeNode;
 import org.apache.flex.compiler.tree.as.ITypedExpressionNode;
 import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
-import org.apache.flex.compiler.tree.as.IVariableNode;
 import org.apache.flex.compiler.tree.as.IWhileLoopNode;
-import org.apache.flex.compiler.utils.ASNodeUtils;
-import org.apache.flex.compiler.visitor.IBlockWalker;
 
 import com.google.debugging.sourcemap.FilePosition;
 
@@ -73,6 +77,23 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
 {
     private JSSessionModel model;
     
+    public NumericLiteralEmitter numericLiteralEmitter;
+    public ParametersEmitter parametersEmitter;
+    public ParameterEmitter parameterEmitter;
+    public FunctionCallArgumentsEmitter functionCallArgumentsEmitter;
+    public LiteralContainerEmitter literalContainerEmitter;
+    public ObjectLiteralValuePairEmitter objectLiteralValuePairEmitter;
+    public ReturnEmitter returnEmitter;
+    public DynamicAccessEmitter dynamicAccessEmitter;
+    public UnaryOperatorEmitter unaryOperatorEmitter;
+    public TernaryOperatorEmitter ternaryOperatorEmitter;
+    public MemberKeywordEmitter memberKeywordEmitter;
+    public IfEmitter ifEmitter;
+    public WhileEmitter whileEmitter;
+    public DoWhileEmitter doWhileEmitter;
+    public IterationFlowEmitter interationFlowEmitter;
+    public SourceMapDirectiveEmitter sourceMapDirectiveEmitter;
+    
     @Override
     public JSSessionModel getModel()
     {
@@ -96,6 +117,23 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
         
         model = new JSSessionModel();
         sourceMapMappings = new ArrayList<SourceMapMapping>();
+
+        numericLiteralEmitter = new NumericLiteralEmitter(this);
+        parametersEmitter = new ParametersEmitter(this);
+        parameterEmitter = new ParameterEmitter(this);
+        functionCallArgumentsEmitter = new FunctionCallArgumentsEmitter(this);
+        literalContainerEmitter = new LiteralContainerEmitter(this);
+        objectLiteralValuePairEmitter = new ObjectLiteralValuePairEmitter(this);
+        returnEmitter = new ReturnEmitter(this);
+        dynamicAccessEmitter = new DynamicAccessEmitter(this);
+        unaryOperatorEmitter = new UnaryOperatorEmitter(this);
+        ternaryOperatorEmitter = new TernaryOperatorEmitter(this);
+        memberKeywordEmitter = new MemberKeywordEmitter(this);
+        ifEmitter = new IfEmitter(this);
+        whileEmitter = new WhileEmitter(this);
+        doWhileEmitter = new DoWhileEmitter(this);
+        interationFlowEmitter = new IterationFlowEmitter(this);
+        sourceMapDirectiveEmitter = new SourceMapDirectiveEmitter(this);
     }
 
     @Override
@@ -140,198 +178,48 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     
     public void emitSourceMapDirective(ITypeNode node)
     {
-        boolean sourceMap = false;
-        
-        IBlockWalker walker = getWalker();
-        FlexJSProject project = (FlexJSProject) walker.getProject();
-        if (project != null)
-        {
-            JSConfiguration config = project.config;
-            if (config != null)
-            {
-                sourceMap = config.getSourceMap();
-            }
-        }
-        
-        if (sourceMap)
-        {
-            writeNewline();
-            write("//# sourceMappingURL=./" + node.getName() + ".js.map");
-        }
+        sourceMapDirectiveEmitter.emit(node);
     }
 
     public void emitParameters(IContainerNode node)
     {
-        startMapping(node);
-        write(ASEmitterTokens.PAREN_OPEN);
-        endMapping(node);
-        
-        int len = node.getChildCount();
-        for (int i = 0; i < len; i++)
-        {
-            IParameterNode parameterNode = (IParameterNode) node.getChild(i);
-            getWalker().walk(parameterNode); //emitParameter
-            if (i < len - 1)
-            {
-                //we're mapping the comma to the container, but we use the
-                //parameter line/column in case the comma is not on the same
-                //line as the opening (
-                startMapping(node, parameterNode);
-                writeToken(ASEmitterTokens.COMMA);
-                endMapping(node);
-            }
-        }
-
-        startMapping(node, node.getLine(), node.getColumn() + node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
-        write(ASEmitterTokens.PAREN_CLOSE);
-        endMapping(node);
+        parametersEmitter.emit(node);
     }
 
     @Override
     public void emitParameter(IParameterNode node)
     {
-        startMapping(node);
-        super.emitParameter(node);
-        endMapping(node);
+        parameterEmitter.emit(node);
     }
 
     @Override
     public void emitArguments(IContainerNode node)
     {
-        startMapping(node);
-        write(ASEmitterTokens.PAREN_OPEN);
-        endMapping(node);
-        
-        int len = node.getChildCount();
-        for (int i = 0; i < len; i++)
-        {
-            IExpressionNode argumentNode = (IExpressionNode) node.getChild(i);
-            getWalker().walk(argumentNode);
-            if (i < len - 1)
-            {
-                //we're mapping the comma to the container, but we use the
-                //parameter line/column in case the comma is not on the same
-                //line as the opening (
-                startMapping(node, argumentNode);
-                writeToken(ASEmitterTokens.COMMA);
-                endMapping(node);
-            }
-        }
-
-        startMapping(node, node.getLine(), node.getColumn() + node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
-        write(ASEmitterTokens.PAREN_CLOSE);
-        endMapping(node);
+        functionCallArgumentsEmitter.emit(node);
     }
 
     @Override
     public void emitNumericLiteral(INumericLiteralNode node)
     {
-        startMapping((ISourceLocation) node);
-        super.emitNumericLiteral(node);
-        endMapping((ISourceLocation) node);
+        numericLiteralEmitter.emit(node);
     }
 
     @Override
     public void emitLiteralContainer(ILiteralContainerNode node)
     {
-        final IContainerNode cnode = node.getContentsNode();
-        final IContainerNode.ContainerType type = cnode.getContainerType();
-        String preFix = null;
-        String postFix = null;
-
-        if (type == IContainerNode.ContainerType.BRACES)
-        {
-            preFix = ASEmitterTokens.BLOCK_OPEN.getToken();
-            postFix = ASEmitterTokens.BLOCK_CLOSE.getToken();
-        }
-        else if (type == IContainerNode.ContainerType.BRACKETS)
-        {
-            preFix = ASEmitterTokens.SQUARE_OPEN.getToken();
-            postFix = ASEmitterTokens.SQUARE_CLOSE.getToken();
-        }
-        else if (type == IContainerNode.ContainerType.IMPLICIT)
-        {
-            // nothing to write, move along
-        }
-        else if (type == IContainerNode.ContainerType.PARENTHESIS)
-        {
-            preFix = ASEmitterTokens.PAREN_OPEN.getToken();
-            postFix = ASEmitterTokens.PAREN_CLOSE.getToken();
-        }
-
-        if (preFix != null)
-        {
-            startMapping(node);
-            write(preFix);
-            endMapping(node);
-        }
-
-        final int len = cnode.getChildCount();
-        for (int i = 0; i < len; i++)
-        {
-            IASNode child = cnode.getChild(i);
-            getWalker().walk(child);
-            if (i < len - 1)
-            {
-                //we're mapping the comma to the literal container, but we fill
-                //the space between the current child and the next because we
-                //don't know exactly where the comma appears in ActionScript
-                startMapping(node, child);
-                writeToken(ASEmitterTokens.COMMA);
-                endMapping(node);
-            }
-        }
-
-        if (postFix != null)
-        {
-            startMapping(node, node.getLine(), node.getColumn() + node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
-            write(postFix);
-            endMapping(node);
-        }
+        literalContainerEmitter.emit(node);
     }
 
     @Override
     public void emitObjectLiteralValuePair(IObjectLiteralValuePairNode node)
     {
-        ISourceLocation sourceLocationNode = (ISourceLocation) node;
-        
-        IExpressionNode nameNode = node.getNameNode();
-        if (!(nameNode instanceof ILiteralNode))
-        {
-            startMapping(nameNode);
-        }
-        getWalker().walk(node.getNameNode());
-        if (!(nameNode instanceof ILiteralNode))
-        {
-            endMapping(nameNode);
-        }
-        
-        startMapping(sourceLocationNode, nameNode);
-        write(ASEmitterTokens.COLON);
-        endMapping(sourceLocationNode);
-
-        IExpressionNode valueNode = node.getValueNode();
-        getWalker().walk(valueNode);
+        objectLiteralValuePairEmitter.emit(node);
     }
 
     @Override
     public void emitReturn(IReturnNode node)
     {
-        IExpressionNode rnode = node.getReturnValueNode();
-        boolean hasReturnValue = rnode != null && rnode.getNodeID() != ASTNodeID.NilID;
-        
-        startMapping(node);
-        write(ASEmitterTokens.RETURN);
-        if (hasReturnValue)
-        {
-            write(ASEmitterTokens.SPACE);
-        }
-        endMapping(node);
-        
-        if (hasReturnValue)
-        {
-            getWalker().walk(rnode);
-        }
+        returnEmitter.emit(node);
     }
 
     @Override
@@ -343,251 +231,49 @@ public class JSEmitter extends ASEmitter implements IJSEmitter
     @Override
     public void emitDynamicAccess(IDynamicAccessNode node)
     {
-        IExpressionNode leftOperandNode = node.getLeftOperandNode();
-        getWalker().walk(leftOperandNode);
-        
-        startMapping(node, leftOperandNode);
-        write(ASEmitterTokens.SQUARE_OPEN);
-        endMapping(node);
-        
-        IExpressionNode rightOperandNode = node.getRightOperandNode();
-        getWalker().walk(rightOperandNode);
-
-        startMapping(node, rightOperandNode);
-        write(ASEmitterTokens.SQUARE_CLOSE);
-        endMapping(node);
+        dynamicAccessEmitter.emit(node);
     }
 
     @Override
     public void emitMemberKeyword(IDefinitionNode node)
     {
-        IKeywordNode keywordNode = null;
-        for(int i = 0; i < node.getChildCount(); i++)
-        {
-            IASNode childNode = node.getChild(i);
-            if (childNode instanceof IKeywordNode)
-            {
-                keywordNode = (IKeywordNode) childNode;
-                break; 
-            }
-        }
-        if (keywordNode != null)
-        {
-            startMapping(keywordNode);
-        }
-        if (node instanceof IFunctionNode)
-        {
-            writeToken(ASEmitterTokens.FUNCTION);
-        }
-        else if (node instanceof IVariableNode)
-        {
-            writeToken(ASEmitterTokens.VAR);
-        }
-        if (keywordNode != null)
-        {
-            endMapping(keywordNode);
-        }
+        memberKeywordEmitter.emit(node);
     }
 
     @Override
-    public void emitConditional(IConditionalNode node, boolean isElseIf)
+    public void emitUnaryOperator(IUnaryOperatorNode node)
     {
-        startMapping(node);
-        if (isElseIf)
-        {
-            writeToken(ASEmitterTokens.ELSE);
-        }
-        writeToken(ASEmitterTokens.IF);
-        write(ASEmitterTokens.PAREN_OPEN);
-        endMapping(node);
-        
-        IASNode conditionalExpression = node.getChild(0);
-        getWalker().walk(conditionalExpression);
-
-        startMapping(node, conditionalExpression);
-        write(ASEmitterTokens.PAREN_CLOSE);
-        IContainerNode xnode = (IContainerNode) node.getStatementContentsNode();
-        if (!isImplicit(xnode))
-            write(ASEmitterTokens.SPACE);
-        endMapping(node);
-
-        getWalker().walk(node.getChild(1)); // BlockNode
+        unaryOperatorEmitter.emit(node);
     }
 
     @Override
-    public void emitElse(ITerminalNode node)
+    public void emitTernaryOperator(ITernaryOperatorNode node)
     {
-        IContainerNode cnode = (IContainerNode) node.getChild(0);
-        
-        // if an implicit if, add a newline with no space
-        final boolean isImplicit = isImplicit(cnode);
-        if (isImplicit)
-            writeNewline();
-        else
-            write(ASEmitterTokens.SPACE);
-        
-        startMapping(node);
-        write(ASEmitterTokens.ELSE);
-        if (!isImplicit)
-            write(ASEmitterTokens.SPACE);
-        endMapping(node);
-
-        getWalker().walk(node); // TerminalNode
+        ternaryOperatorEmitter.emit(node);
     }
 
     @Override
-    public void emitTernaryOperator(ITernaryOperatorNode node)
+    public void emitIf(IIfNode node)
     {
-        if (ASNodeUtils.hasParenOpen((IOperatorNode) node))
-            write(ASEmitterTokens.PAREN_OPEN);
-        
-        IExpressionNode conditionalNode = node.getConditionalNode();
-        getWalker().walk(conditionalNode);
-
-        IExpressionNode leftOperandNode = node.getLeftOperandNode();
-        startMapping(node, conditionalNode);
-        write(ASEmitterTokens.SPACE);
-        writeToken(ASEmitterTokens.TERNARY);
-        endMapping(node);
-        
-        getWalker().walk(leftOperandNode);
-
-        IExpressionNode rightOperandNode = node.getRightOperandNode();
-        startMapping(node, leftOperandNode);
-        write(ASEmitterTokens.SPACE);
-        writeToken(ASEmitterTokens.COLON);
-        endMapping(node);
-        
-        getWalker().walk(rightOperandNode);
-        
-        if (ASNodeUtils.hasParenClose((IOperatorNode) node))
-            write(ASEmitterTokens.PAREN_CLOSE);
+        ifEmitter.emit(node);
     }
 
     @Override
     public void emitWhileLoop(IWhileLoopNode node)
     {
-        IContainerNode cnode = (IContainerNode) node.getChild(1);
-        
-        startMapping(node);
-        writeToken(ASEmitterTokens.WHILE);
-        write(ASEmitterTokens.PAREN_OPEN);
-        endMapping(node);
-
-        IASNode conditionalExpression = node.getConditionalExpressionNode();
-        getWalker().walk(conditionalExpression);
-
-        IASNode statementContentsNode = node.getStatementContentsNode();
-        startMapping(node, conditionalExpression);
-        write(ASEmitterTokens.PAREN_CLOSE);
-        if (!isImplicit(cnode))
-            write(ASEmitterTokens.SPACE);
-        endMapping(node);
-        
-        getWalker().walk(statementContentsNode);
+        whileEmitter.emit(node);
     }
 
     @Override
     public void emitDoLoop(IWhileLoopNode node)
     {
-        IContainerNode cnode = (IContainerNode) node.getChild(0);
-        
-        startMapping(node);
-        write(ASEmitterTokens.DO);
-        if (!isImplicit(cnode))
-            write(ASEmitterTokens.SPACE);
-        endMapping(node);
-
-        IASNode statementContents = node.getStatementContentsNode();
-        getWalker().walk(statementContents);
-
-        IASNode conditionalExpressionNode = node.getConditionalExpressionNode();
-        startMapping(node, statementContents);
-        if (!isImplicit(cnode))
-            write(ASEmitterTokens.SPACE);
-        else
-            writeNewline(); // TODO (mschmalle) there is something wrong here, block should NL
-        write(ASEmitterTokens.WHILE);
-        write(ASEmitterTokens.SPACE);
-        write(ASEmitterTokens.PAREN_OPEN);
-        endMapping(node);
-
-        getWalker().walk(conditionalExpressionNode);
-        
-        startMapping(node, conditionalExpressionNode);
-        write(ASEmitterTokens.PAREN_CLOSE);
-        write(ASEmitterTokens.SEMICOLON);
-        endMapping(node);
-    }
-
-    @Override
-    public void emitPreUnaryOperator(IUnaryOperatorNode node)
-    {
-        startMapping(node);
-        write(node.getOperator().getOperatorText());
-        IExpressionNode opNode = node.getOperandNode();
-        endMapping(node);
-        getWalker().walk(opNode);
-    }
-
-    @Override
-    public void emitPostUnaryOperator(IUnaryOperatorNode node)
-    {
-        IExpressionNode operandNode = node.getOperandNode();
-        getWalker().walk(operandNode);
-        startMapping(node, operandNode);
-        write(node.getOperator().getOperatorText());
-        endMapping(node);
-    }
-
-    @Override
-    public void emitDeleteOperator(IUnaryOperatorNode node)
-    {
-        startMapping(node);
-        writeToken(node.getOperator().getOperatorText());
-        endMapping(node);
-        getWalker().walk(node.getOperandNode());
-    }
-
-    @Override
-    public void emitVoidOperator(IUnaryOperatorNode node)
-    {
-        startMapping(node);
-        writeToken(node.getOperator().getOperatorText());
-        endMapping(node);
-        getWalker().walk(node.getOperandNode());
-    }
-
-    @Override
-    public void emitTypeOfOperator(IUnaryOperatorNode node)
-    {
-        startMapping(node);
-        write(node.getOperator().getOperatorText());
-        write(ASEmitterTokens.PAREN_OPEN);
-        endMapping(node);
-        IExpressionNode operandNode = node.getOperandNode();
-        getWalker().walk(operandNode);
-        startMapping(node);
-        write(ASEmitterTokens.PAREN_CLOSE);
-        endMapping(node);
+        doWhileEmitter.emit(node);
     }
 
     @Override
     public void emitIterationFlow(IIterationFlowNode node)
     {
-        startMapping(node);
-        write(node.getKind().toString().toLowerCase());
-        IIdentifierNode lnode = node.getLabelNode();
-        if (lnode != null)
-        {
-            write(ASEmitterTokens.SPACE);
-            endMapping(node);
-            getWalker().walk(lnode);
-        }
-        else
-        {
-            endMapping(node);
-        }
+        interationFlowEmitter.emit(node);
     }
 
     public void pushSourceMapName(ISourceLocation node)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSSubEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSSubEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSSubEmitter.java
index e4a413f..be0b9d1 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSSubEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/JSSubEmitter.java
@@ -21,6 +21,7 @@ package org.apache.flex.compiler.internal.codegen.js;
 
 import org.apache.flex.compiler.codegen.IEmitterTokens;
 import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.common.ISourceLocation;
 import org.apache.flex.compiler.projects.ICompilerProject;
 import org.apache.flex.compiler.visitor.IBlockWalker;
 
@@ -102,4 +103,24 @@ public class JSSubEmitter
     {
         emitter.indentPop();
     }
+
+    protected void startMapping(ISourceLocation node)
+    {
+        emitter.startMapping(node);
+    }
+
+    protected void startMapping(ISourceLocation node, int line, int column)
+    {
+        emitter.startMapping(node, line, column);
+    }
+
+    protected void startMapping(ISourceLocation node, ISourceLocation nodeBeforeMapping)
+    {
+        emitter.startMapping(node, nodeBeforeMapping);
+    }
+
+    protected void endMapping(ISourceLocation node)
+    {
+        emitter.endMapping(node);
+    }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DoWhileEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DoWhileEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DoWhileEmitter.java
new file mode 100644
index 0000000..4dfafac
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DoWhileEmitter.java
@@ -0,0 +1,71 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+import org.apache.flex.compiler.tree.as.IWhileLoopNode;
+
+public class DoWhileEmitter extends JSSubEmitter implements
+        ISubEmitter<IWhileLoopNode>
+{
+    public DoWhileEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IWhileLoopNode node)
+    {
+        IContainerNode cnode = (IContainerNode) node.getChild(0);
+
+        startMapping(node);
+        write(ASEmitterTokens.DO);
+        if (!EmitterUtils.isImplicit(cnode))
+            write(ASEmitterTokens.SPACE);
+        endMapping(node);
+
+        IASNode statementContents = node.getStatementContentsNode();
+        getWalker().walk(statementContents);
+
+        IASNode conditionalExpressionNode = node.getConditionalExpressionNode();
+        startMapping(node, statementContents);
+        if (!EmitterUtils.isImplicit(cnode))
+            write(ASEmitterTokens.SPACE);
+        else
+            writeNewline(); // TODO (mschmalle) there is something wrong here, block should NL
+        write(ASEmitterTokens.WHILE);
+        write(ASEmitterTokens.SPACE);
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+
+        getWalker().walk(conditionalExpressionNode);
+
+        startMapping(node, conditionalExpressionNode);
+        write(ASEmitterTokens.PAREN_CLOSE);
+        write(ASEmitterTokens.SEMICOLON);
+        endMapping(node);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DynamicAccessEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DynamicAccessEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DynamicAccessEmitter.java
new file mode 100644
index 0000000..f02d298
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/DynamicAccessEmitter.java
@@ -0,0 +1,54 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+
+public class DynamicAccessEmitter extends JSSubEmitter implements
+        ISubEmitter<IDynamicAccessNode>
+{
+    public DynamicAccessEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IDynamicAccessNode node)
+    {
+        IExpressionNode leftOperandNode = node.getLeftOperandNode();
+        getWalker().walk(leftOperandNode);
+
+        startMapping(node, leftOperandNode);
+        write(ASEmitterTokens.SQUARE_OPEN);
+        endMapping(node);
+
+        IExpressionNode rightOperandNode = node.getRightOperandNode();
+        getWalker().walk(rightOperandNode);
+
+        startMapping(node, rightOperandNode);
+        write(ASEmitterTokens.SQUARE_CLOSE);
+        endMapping(node);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallArgumentsEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallArgumentsEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallArgumentsEmitter.java
new file mode 100644
index 0000000..f875e92
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallArgumentsEmitter.java
@@ -0,0 +1,64 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+
+public class FunctionCallArgumentsEmitter extends JSSubEmitter implements
+        ISubEmitter<IContainerNode>
+{
+    public FunctionCallArgumentsEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IContainerNode node)
+    {
+        startMapping(node);
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+
+        int len = node.getChildCount();
+        for (int i = 0; i < len; i++)
+        {
+            IExpressionNode argumentNode = (IExpressionNode) node.getChild(i);
+            getWalker().walk(argumentNode);
+            if (i < len - 1)
+            {
+                //we're mapping the comma to the container, but we use the
+                //parameter line/column in case the comma is not on the same
+                //line as the opening (
+                startMapping(node, argumentNode);
+                writeToken(ASEmitterTokens.COMMA);
+                endMapping(node);
+            }
+        }
+
+        startMapping(node, node.getLine(), node.getColumn() + node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
+        write(ASEmitterTokens.PAREN_CLOSE);
+        endMapping(node);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IfEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IfEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IfEmitter.java
new file mode 100644
index 0000000..5370a95
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IfEmitter.java
@@ -0,0 +1,117 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IConditionalNode;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+import org.apache.flex.compiler.tree.as.IIfNode;
+import org.apache.flex.compiler.tree.as.ITerminalNode;
+
+public class IfEmitter extends JSSubEmitter implements
+        ISubEmitter<IIfNode>
+{
+    public IfEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IIfNode node)
+    {
+        IConditionalNode conditional = (IConditionalNode) node.getChild(0);
+        emitConditional(conditional, false);
+
+        IConditionalNode[] nodes = node.getElseIfNodes();
+        if (nodes.length > 0)
+        {
+            for (int i = 0; i < nodes.length; i++)
+            {
+                IConditionalNode enode = nodes[i];
+                IContainerNode snode = (IContainerNode) enode
+                        .getStatementContentsNode();
+
+                final boolean isImplicit = EmitterUtils.isImplicit(snode);
+                if (isImplicit)
+                    writeNewline();
+                else
+                    write(ASEmitterTokens.SPACE);
+
+                emitConditional(enode, true);
+            }
+        }
+
+        ITerminalNode elseNode = node.getElseNode();
+        if (elseNode != null)
+        {
+            emitElse(elseNode);
+        }
+        
+    }
+
+    protected void emitConditional(IConditionalNode node, boolean isElseIf)
+    {
+        startMapping(node);
+        if (isElseIf)
+        {
+            writeToken(ASEmitterTokens.ELSE);
+        }
+        writeToken(ASEmitterTokens.IF);
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+
+        IASNode conditionalExpression = node.getChild(0);
+        getWalker().walk(conditionalExpression);
+
+        startMapping(node, conditionalExpression);
+        write(ASEmitterTokens.PAREN_CLOSE);
+        IContainerNode xnode = (IContainerNode) node.getStatementContentsNode();
+        if (!EmitterUtils.isImplicit(xnode))
+            write(ASEmitterTokens.SPACE);
+        endMapping(node);
+
+        getWalker().walk(node.getChild(1)); // BlockNode
+    }
+
+    protected void emitElse(ITerminalNode node)
+    {
+        IContainerNode cnode = (IContainerNode) node.getChild(0);
+
+        // if an implicit if, add a newline with no space
+        final boolean isImplicit = EmitterUtils.isImplicit(cnode);
+        if (isImplicit)
+            writeNewline();
+        else
+            write(ASEmitterTokens.SPACE);
+
+        startMapping(node);
+        write(ASEmitterTokens.ELSE);
+        if (!isImplicit)
+            write(ASEmitterTokens.SPACE);
+        endMapping(node);
+
+        getWalker().walk(node); // TerminalNode
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IterationFlowEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IterationFlowEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IterationFlowEmitter.java
new file mode 100644
index 0000000..25c2d10
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/IterationFlowEmitter.java
@@ -0,0 +1,54 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.IIdentifierNode;
+import org.apache.flex.compiler.tree.as.IIterationFlowNode;
+
+public class IterationFlowEmitter extends JSSubEmitter implements
+        ISubEmitter<IIterationFlowNode>
+{
+    public IterationFlowEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IIterationFlowNode node)
+    {
+        startMapping(node);
+        write(node.getKind().toString().toLowerCase());
+        IIdentifierNode lnode = node.getLabelNode();
+        if (lnode != null)
+        {
+            write(ASEmitterTokens.SPACE);
+            endMapping(node);
+            getWalker().walk(lnode);
+        }
+        else
+        {
+            endMapping(node);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralContainerEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralContainerEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralContainerEmitter.java
new file mode 100644
index 0000000..d1d24fd
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/LiteralContainerEmitter.java
@@ -0,0 +1,96 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+import org.apache.flex.compiler.tree.as.ILiteralContainerNode;
+
+public class LiteralContainerEmitter extends JSSubEmitter implements
+        ISubEmitter<ILiteralContainerNode>
+{
+    public LiteralContainerEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(ILiteralContainerNode node)
+    {
+        final IContainerNode cnode = node.getContentsNode();
+        final IContainerNode.ContainerType type = cnode.getContainerType();
+        String preFix = null;
+        String postFix = null;
+
+        if (type == IContainerNode.ContainerType.BRACES)
+        {
+            preFix = ASEmitterTokens.BLOCK_OPEN.getToken();
+            postFix = ASEmitterTokens.BLOCK_CLOSE.getToken();
+        }
+        else if (type == IContainerNode.ContainerType.BRACKETS)
+        {
+            preFix = ASEmitterTokens.SQUARE_OPEN.getToken();
+            postFix = ASEmitterTokens.SQUARE_CLOSE.getToken();
+        }
+        else if (type == IContainerNode.ContainerType.IMPLICIT)
+        {
+            // nothing to write, move along
+        }
+        else if (type == IContainerNode.ContainerType.PARENTHESIS)
+        {
+            preFix = ASEmitterTokens.PAREN_OPEN.getToken();
+            postFix = ASEmitterTokens.PAREN_CLOSE.getToken();
+        }
+
+        if (preFix != null)
+        {
+            startMapping(node);
+            write(preFix);
+            endMapping(node);
+        }
+
+        final int len = cnode.getChildCount();
+        for (int i = 0; i < len; i++)
+        {
+            IASNode child = cnode.getChild(i);
+            getWalker().walk(child);
+            if (i < len - 1)
+            {
+                //we're mapping the comma to the literal container, but we fill
+                //the space between the current child and the next because we
+                //don't know exactly where the comma appears in ActionScript
+                startMapping(node, child);
+                writeToken(ASEmitterTokens.COMMA);
+                endMapping(node);
+            }
+        }
+
+        if (postFix != null)
+        {
+            startMapping(node, node.getLine(), node.getColumn() + node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
+            write(postFix);
+            endMapping(node);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberKeywordEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberKeywordEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberKeywordEmitter.java
new file mode 100644
index 0000000..3f71c78
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/MemberKeywordEmitter.java
@@ -0,0 +1,70 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IDefinitionNode;
+import org.apache.flex.compiler.tree.as.IFunctionNode;
+import org.apache.flex.compiler.tree.as.IKeywordNode;
+import org.apache.flex.compiler.tree.as.IVariableNode;
+
+public class MemberKeywordEmitter extends JSSubEmitter implements
+        ISubEmitter<IDefinitionNode>
+{
+    public MemberKeywordEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IDefinitionNode node)
+    {
+        IKeywordNode keywordNode = null;
+        for(int i = 0; i < node.getChildCount(); i++)
+        {
+            IASNode childNode = node.getChild(i);
+            if (childNode instanceof IKeywordNode)
+            {
+                keywordNode = (IKeywordNode) childNode;
+                break;
+            }
+        }
+        if (keywordNode != null)
+        {
+            startMapping(keywordNode);
+        }
+        if (node instanceof IFunctionNode)
+        {
+            writeToken(ASEmitterTokens.FUNCTION);
+        }
+        else if (node instanceof IVariableNode)
+        {
+            writeToken(ASEmitterTokens.VAR);
+        }
+        if (keywordNode != null)
+        {
+            endMapping(keywordNode);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/NumericLiteralEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/NumericLiteralEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/NumericLiteralEmitter.java
new file mode 100644
index 0000000..604d1d6
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/NumericLiteralEmitter.java
@@ -0,0 +1,43 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.common.ISourceLocation;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.INumericLiteralNode;
+
+public class NumericLiteralEmitter extends JSSubEmitter implements
+        ISubEmitter<INumericLiteralNode>
+{
+    public NumericLiteralEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(INumericLiteralNode node)
+    {
+        startMapping((ISourceLocation) node);
+        write(node.getNumericValue().toString());
+        endMapping((ISourceLocation) node);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java
new file mode 100644
index 0000000..0c36871
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java
@@ -0,0 +1,62 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.common.ISourceLocation;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.ILiteralNode;
+import org.apache.flex.compiler.tree.as.IObjectLiteralValuePairNode;
+
+public class ObjectLiteralValuePairEmitter extends JSSubEmitter implements
+        ISubEmitter<IObjectLiteralValuePairNode>
+{
+    public ObjectLiteralValuePairEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IObjectLiteralValuePairNode node)
+    {
+        ISourceLocation sourceLocationNode = (ISourceLocation) node;
+
+        IExpressionNode nameNode = node.getNameNode();
+        if (!(nameNode instanceof ILiteralNode))
+        {
+            startMapping(nameNode);
+        }
+        getWalker().walk(node.getNameNode());
+        if (!(nameNode instanceof ILiteralNode))
+        {
+            endMapping(nameNode);
+        }
+
+        startMapping(sourceLocationNode, nameNode);
+        write(ASEmitterTokens.COLON);
+        endMapping(sourceLocationNode);
+
+        IExpressionNode valueNode = node.getValueNode();
+        getWalker().walk(valueNode);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ParameterEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ParameterEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ParameterEmitter.java
new file mode 100644
index 0000000..ef5c5a5
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ParameterEmitter.java
@@ -0,0 +1,62 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IParameterNode;
+import org.apache.flex.compiler.tree.as.IWhileLoopNode;
+
+public class ParameterEmitter extends JSSubEmitter implements
+        ISubEmitter<IParameterNode>
+{
+    public ParameterEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IParameterNode node)
+    {
+        startMapping(node);
+        if (node.isRest())
+        {
+            write(ASEmitterTokens.ELLIPSIS);
+            write(node.getName());
+        }
+        else
+        {
+            getWalker().walk(node.getNameExpressionNode());
+            write(ASEmitterTokens.COLON);
+            getWalker().walk(node.getVariableTypeNode());
+            IExpressionNode anode = node.getAssignedValueNode();
+            if (anode != null)
+            {
+                write(ASEmitterTokens.SPACE);
+                writeToken(ASEmitterTokens.EQUAL);
+                getWalker().walk(anode);
+            }
+        }
+        endMapping(node);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ParametersEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ParametersEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ParametersEmitter.java
new file mode 100644
index 0000000..01e1f25
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ParametersEmitter.java
@@ -0,0 +1,64 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+import org.apache.flex.compiler.tree.as.IParameterNode;
+
+public class ParametersEmitter extends JSSubEmitter implements
+        ISubEmitter<IContainerNode>
+{
+    public ParametersEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IContainerNode node)
+    {
+        startMapping(node);
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+
+        int len = node.getChildCount();
+        for (int i = 0; i < len; i++)
+        {
+            IParameterNode parameterNode = (IParameterNode) node.getChild(i);
+            getWalker().walk(parameterNode); //emitParameter
+            if (i < len - 1)
+            {
+                //we're mapping the comma to the container, but we use the
+                //parameter line/column in case the comma is not on the same
+                //line as the opening (
+                startMapping(node, parameterNode);
+                writeToken(ASEmitterTokens.COMMA);
+                endMapping(node);
+            }
+        }
+
+        startMapping(node, node.getLine(), node.getColumn() + node.getAbsoluteEnd() - node.getAbsoluteStart() - 1);
+        write(ASEmitterTokens.PAREN_CLOSE);
+        endMapping(node);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ReturnEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ReturnEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ReturnEmitter.java
new file mode 100644
index 0000000..407b80c
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/ReturnEmitter.java
@@ -0,0 +1,57 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IReturnNode;
+
+public class ReturnEmitter extends JSSubEmitter implements
+        ISubEmitter<IReturnNode>
+{
+    public ReturnEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IReturnNode node)
+    {
+        IExpressionNode rnode = node.getReturnValueNode();
+        boolean hasReturnValue = rnode != null && rnode.getNodeID() != ASTNodeID.NilID;
+
+        startMapping(node);
+        write(ASEmitterTokens.RETURN);
+        if (hasReturnValue)
+        {
+            write(ASEmitterTokens.SPACE);
+        }
+        endMapping(node);
+
+        if (hasReturnValue)
+        {
+            getWalker().walk(rnode);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java
new file mode 100644
index 0000000..14674de
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/SourceMapDirectiveEmitter.java
@@ -0,0 +1,60 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.clients.JSConfiguration;
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.internal.projects.FlexJSProject;
+import org.apache.flex.compiler.tree.as.ITypeNode;
+import org.apache.flex.compiler.visitor.IBlockWalker;
+
+public class SourceMapDirectiveEmitter extends JSSubEmitter implements
+        ISubEmitter<ITypeNode>
+{
+    public SourceMapDirectiveEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(ITypeNode node)
+    {
+        boolean sourceMap = false;
+
+        IBlockWalker walker = getWalker();
+        FlexJSProject project = (FlexJSProject) walker.getProject();
+        if (project != null)
+        {
+            JSConfiguration config = project.config;
+            if (config != null)
+            {
+                sourceMap = config.getSourceMap();
+            }
+        }
+
+        if (sourceMap)
+        {
+            writeNewline();
+            write("//# sourceMappingURL=./" + node.getName() + ".js.map");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/TernaryOperatorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/TernaryOperatorEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/TernaryOperatorEmitter.java
new file mode 100644
index 0000000..8273e1b
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/TernaryOperatorEmitter.java
@@ -0,0 +1,67 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IOperatorNode;
+import org.apache.flex.compiler.tree.as.ITernaryOperatorNode;
+import org.apache.flex.compiler.utils.ASNodeUtils;
+
+public class TernaryOperatorEmitter extends JSSubEmitter implements
+        ISubEmitter<ITernaryOperatorNode>
+{
+    public TernaryOperatorEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(ITernaryOperatorNode node)
+    {
+        if (ASNodeUtils.hasParenOpen((IOperatorNode) node))
+            write(ASEmitterTokens.PAREN_OPEN);
+
+        IExpressionNode conditionalNode = node.getConditionalNode();
+        getWalker().walk(conditionalNode);
+
+        IExpressionNode leftOperandNode = node.getLeftOperandNode();
+        startMapping(node, conditionalNode);
+        write(ASEmitterTokens.SPACE);
+        writeToken(ASEmitterTokens.TERNARY);
+        endMapping(node);
+
+        getWalker().walk(leftOperandNode);
+
+        IExpressionNode rightOperandNode = node.getRightOperandNode();
+        startMapping(node, leftOperandNode);
+        write(ASEmitterTokens.SPACE);
+        writeToken(ASEmitterTokens.COLON);
+        endMapping(node);
+
+        getWalker().walk(rightOperandNode);
+
+        if (ASNodeUtils.hasParenClose((IOperatorNode) node))
+            write(ASEmitterTokens.PAREN_CLOSE);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/UnaryOperatorEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/UnaryOperatorEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/UnaryOperatorEmitter.java
new file mode 100644
index 0000000..88bb154
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/UnaryOperatorEmitter.java
@@ -0,0 +1,122 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.as.IExpressionNode;
+import org.apache.flex.compiler.tree.as.IUnaryOperatorNode;
+import org.apache.flex.compiler.utils.ASNodeUtils;
+
+public class UnaryOperatorEmitter extends JSSubEmitter implements
+        ISubEmitter<IUnaryOperatorNode>
+{
+    public UnaryOperatorEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IUnaryOperatorNode node)
+    {
+        if (ASNodeUtils.hasParenOpen(node))
+            write(ASEmitterTokens.PAREN_OPEN);
+
+        if (node.getNodeID() == ASTNodeID.Op_PreIncrID
+                || node.getNodeID() == ASTNodeID.Op_PreDecrID
+                || node.getNodeID() == ASTNodeID.Op_BitwiseNotID
+                || node.getNodeID() == ASTNodeID.Op_LogicalNotID
+                || node.getNodeID() == ASTNodeID.Op_SubtractID
+                || node.getNodeID() == ASTNodeID.Op_AddID)
+        {
+            emitPreUnaryOperator(node);
+        }
+        else if (node.getNodeID() == ASTNodeID.Op_PostIncrID
+                || node.getNodeID() == ASTNodeID.Op_PostDecrID)
+        {
+            emitPostUnaryOperator(node);
+        }
+        else if (node.getNodeID() == ASTNodeID.Op_DeleteID)
+        {
+            emitDeleteOperator(node);
+        }
+        else if (node.getNodeID() == ASTNodeID.Op_VoidID)
+        {
+            emitVoidOperator(node);
+        }
+        else if (node.getNodeID() == ASTNodeID.Op_TypeOfID)
+        {
+            emitTypeOfOperator(node);
+        }
+
+        if (ASNodeUtils.hasParenClose(node))
+            write(ASEmitterTokens.PAREN_CLOSE);
+    }
+
+    public void emitPreUnaryOperator(IUnaryOperatorNode node)
+    {
+        startMapping(node);
+        write(node.getOperator().getOperatorText());
+        IExpressionNode opNode = node.getOperandNode();
+        endMapping(node);
+        getWalker().walk(opNode);
+    }
+
+    protected void emitPostUnaryOperator(IUnaryOperatorNode node)
+    {
+        IExpressionNode operandNode = node.getOperandNode();
+        getWalker().walk(operandNode);
+        startMapping(node, operandNode);
+        write(node.getOperator().getOperatorText());
+        endMapping(node);
+    }
+
+    protected void emitDeleteOperator(IUnaryOperatorNode node)
+    {
+        startMapping(node);
+        writeToken(node.getOperator().getOperatorText());
+        endMapping(node);
+        getWalker().walk(node.getOperandNode());
+    }
+
+    protected void emitVoidOperator(IUnaryOperatorNode node)
+    {
+        startMapping(node);
+        writeToken(node.getOperator().getOperatorText());
+        endMapping(node);
+        getWalker().walk(node.getOperandNode());
+    }
+
+    protected void emitTypeOfOperator(IUnaryOperatorNode node)
+    {
+        startMapping(node);
+        write(node.getOperator().getOperatorText());
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+        IExpressionNode operandNode = node.getOperandNode();
+        getWalker().walk(operandNode);
+        startMapping(node);
+        write(ASEmitterTokens.PAREN_CLOSE);
+        endMapping(node);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/WhileEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/WhileEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/WhileEmitter.java
new file mode 100644
index 0000000..8ff0e84
--- /dev/null
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/jx/WhileEmitter.java
@@ -0,0 +1,61 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.codegen.js.jx;
+
+import org.apache.flex.compiler.codegen.ISubEmitter;
+import org.apache.flex.compiler.codegen.js.IJSEmitter;
+import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
+import org.apache.flex.compiler.internal.codegen.js.JSSubEmitter;
+import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
+import org.apache.flex.compiler.tree.as.IASNode;
+import org.apache.flex.compiler.tree.as.IContainerNode;
+import org.apache.flex.compiler.tree.as.IWhileLoopNode;
+
+public class WhileEmitter extends JSSubEmitter implements
+        ISubEmitter<IWhileLoopNode>
+{
+    public WhileEmitter(IJSEmitter emitter)
+    {
+        super(emitter);
+    }
+
+    @Override
+    public void emit(IWhileLoopNode node)
+    {
+        IContainerNode cnode = (IContainerNode) node.getChild(1);
+
+        startMapping(node);
+        writeToken(ASEmitterTokens.WHILE);
+        write(ASEmitterTokens.PAREN_OPEN);
+        endMapping(node);
+
+        IASNode conditionalExpression = node.getConditionalExpressionNode();
+        getWalker().walk(conditionalExpression);
+
+        IASNode statementContentsNode = node.getStatementContentsNode();
+        startMapping(node, conditionalExpression);
+        write(ASEmitterTokens.PAREN_CLOSE);
+        if (!EmitterUtils.isImplicit(cnode))
+            write(ASEmitterTokens.SPACE);
+        endMapping(node);
+
+        getWalker().walk(statementContentsNode);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c3b8a2b8/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
index 3e59a8d..ecfdde7 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/js/utils/EmitterUtils.java
@@ -505,4 +505,10 @@ public class EmitterUtils
         return result;
     }
 
+    public static boolean isImplicit(IContainerNode node)
+    {
+        return node.getContainerType() == IContainerNode.ContainerType.IMPLICIT
+                || node.getContainerType() == IContainerNode.ContainerType.SYNTHESIZED;
+    }
+
 }