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/18 15:32:02 UTC

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

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/beaf5b63/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
----------------------------------------------------------------------
diff --cc compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
index a50e288,0000000..d0a4aa8
mode 100644,000000..100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSEmitter.java
@@@ -1,453 -1,0 +1,471 @@@
 +/*
 + *
 + *  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;
 +
 +import java.io.FilterWriter;
 +import java.util.ArrayList;
 +import java.util.List;
 +import java.util.Stack;
 +
 +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.BlockCloseEmitter;
++import org.apache.flex.compiler.internal.codegen.js.jx.BlockOpenEmitter;
 +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;
 +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;
 +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.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;
 +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;
 +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;
 +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.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.IWhileLoopNode;
 +
 +import com.google.debugging.sourcemap.FilePosition;
 +
 +/**
 + * @author Michael Schmalle
 + */
 +public class JSEmitter extends ASEmitter implements IJSEmitter
 +{
 +    private JSSessionModel model;
 +    
++    public BlockOpenEmitter blockOpenEmitter;
++    public BlockCloseEmitter blockCloseEmitter;
 +    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 WhileLoopEmitter whileLoopEmitter;
 +    public DoWhileLoopEmitter doWhileLoopEmitter;
 +    public ForLoopEmitter forLoopEmitter;
 +    public IterationFlowEmitter interationFlowEmitter;
 +    public StatementEmitter statementEmitter;
 +    public LanguageIdentifierEmitter languageIdentifierEmitter;
 +    public SourceMapDirectiveEmitter sourceMapDirectiveEmitter;
 +    
 +    @Override
 +    public JSSessionModel getModel()
 +    {
 +        return model;
 +    }
 +    
 +    private SourceMapMapping lastMapping;
 +    
 +    private Stack<String> nameStack = new Stack<String>();
 +    
 +    private List<SourceMapMapping> sourceMapMappings;
 +    
 +    public List<SourceMapMapping> getSourceMapMappings()
 +    {
 +        return sourceMapMappings;
 +    }
 +
 +    public JSEmitter(FilterWriter out)
 +    {
 +        super(out);
 +        
 +        model = new JSSessionModel();
 +        sourceMapMappings = new ArrayList<SourceMapMapping>();
 +
++        blockOpenEmitter = new BlockOpenEmitter(this);
++        blockCloseEmitter = new BlockCloseEmitter(this);
 +        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);
 +        whileLoopEmitter = new WhileLoopEmitter(this);
 +        doWhileLoopEmitter = new DoWhileLoopEmitter(this);
 +        forLoopEmitter = new ForLoopEmitter(this);
 +        interationFlowEmitter = new IterationFlowEmitter(this);
 +        statementEmitter = new StatementEmitter(this);
 +        languageIdentifierEmitter = new LanguageIdentifierEmitter(this);
 +        sourceMapDirectiveEmitter = new SourceMapDirectiveEmitter(this);
 +    }
 +
 +    @Override
 +    public String formatQualifiedName(String name)
 +    {
 +        return name;
 +    }
 +    
 +    @Override
 +    public void emitLocalNamedFunction(IFunctionNode node)
 +    {
 +        startMapping(node);
 +        FunctionNode fnode = (FunctionNode)node;
 +        write(ASEmitterTokens.FUNCTION);
 +        write(ASEmitterTokens.SPACE);
 +        write(fnode.getName());
 +        endMapping(node);
 +        emitParameters(fnode.getParametersContainerNode());
 +        emitFunctionScope(fnode.getScopedNode());
 +    }
 +    
 +    @Override
 +    public void emitFunctionObject(IFunctionObjectNode node)
 +    {
 +        startMapping(node);
 +        FunctionNode fnode = node.getFunctionNode();
 +        write(ASEmitterTokens.FUNCTION);
 +        endMapping(node);
 +        emitParameters(fnode.getParametersContainerNode());
 +        emitFunctionScope(fnode.getScopedNode());
 +    }
 +
 +    public void emitClosureStart()
 +    {
 +    	
 +    }
 +
 +    public void emitClosureEnd(IASNode node)
 +    {
 +    	
 +    }
 +    
 +    public void emitSourceMapDirective(ITypeNode node)
 +    {
 +        sourceMapDirectiveEmitter.emit(node);
 +    }
 +
 +    public void emitParameters(IContainerNode node)
 +    {
 +        parametersEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitParameter(IParameterNode node)
 +    {
 +        parameterEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitArguments(IContainerNode node)
 +    {
 +        functionCallArgumentsEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitNumericLiteral(INumericLiteralNode node)
 +    {
 +        numericLiteralEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitLiteralContainer(ILiteralContainerNode node)
 +    {
 +        literalContainerEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitObjectLiteralValuePair(IObjectLiteralValuePairNode node)
 +    {
 +        objectLiteralValuePairEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitReturn(IReturnNode node)
 +    {
 +        returnEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitTypedExpression(ITypedExpressionNode node)
 +    {
 +        write(JSEmitterTokens.ARRAY);
 +    }
 +
 +    @Override
 +    public void emitDynamicAccess(IDynamicAccessNode node)
 +    {
 +        dynamicAccessEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitMemberKeyword(IDefinitionNode node)
 +    {
 +        memberKeywordEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitUnaryOperator(IUnaryOperatorNode node)
 +    {
 +        unaryOperatorEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitTernaryOperator(ITernaryOperatorNode node)
 +    {
 +        ternaryOperatorEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitLanguageIdentifier(ILanguageIdentifierNode node)
 +    {
 +        languageIdentifierEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitStatement(IASNode node)
 +    {
 +        statementEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitIf(IIfNode node)
 +    {
 +        ifEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitWhileLoop(IWhileLoopNode node)
 +    {
 +        whileLoopEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitDoLoop(IWhileLoopNode node)
 +    {
 +        doWhileLoopEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitForLoop(IForLoopNode node)
 +    {
 +        forLoopEmitter.emit(node);
 +    }
 +
 +    @Override
 +    public void emitIterationFlow(IIterationFlowNode node)
 +    {
 +        interationFlowEmitter.emit(node);
 +    }
 +
++    @Override
++    public void emitBlockOpen(IContainerNode node)
++    {
++        blockOpenEmitter.emit(node);
++    }
++
++    @Override
++    public void emitBlockClose(IContainerNode node)
++    {
++        blockCloseEmitter.emit(node);
++    }
++
 +    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, node.getLine(), node.getColumn());
 +    }
- 
-     public void startMapping(ISourceLocation node, ISourceLocation nodeBeforeMapping)
-     {
-         startMapping(node, nodeBeforeMapping.getLine(), nodeBeforeMapping.getColumn() + nodeBeforeMapping.getAbsoluteEnd() - nodeBeforeMapping.getAbsoluteStart());
-     }
 +    
 +    public void startMapping(ISourceLocation node, int line, int column)
 +    {
 +        if (lastMapping != null)
 +        {
 +            FilePosition sourceStartPosition = lastMapping.sourceStartPosition;
 +            throw new IllegalStateException("Cannot start new mapping when another mapping is already started. "
 +                    + "Previous mapping at Line " + sourceStartPosition.getLine()
 +                    + " and Column " + sourceStartPosition.getColumn()
 +                    + " in file " + lastMapping.sourcePath);
 +        }
 +        
 +        String sourcePath = node.getSourcePath();
 +        if (sourcePath == null)
 +        {
 +            //if the source path is null, this node may have been generated by
 +            //the compiler automatically. for example, an untyped variable will
 +            //have a node for the * type.
 +            if (node instanceof IASNode)
 +            {
 +                IASNode parentNode = ((IASNode) node).getParent();
 +                if (parentNode != null)
 +                {
 +                    //try the parent node
 +                    startMapping(parentNode, line, column);
 +                    return;
 +                }
 +            }
 +        }
 +        
 +        String nodeName = null;
 +        if (nameStack.size() > 0)
 +        {
 +            nodeName = nameStack.lastElement();
 +        }
 +        SourceMapMapping mapping = new SourceMapMapping();
 +        mapping.sourcePath = sourcePath;
 +        mapping.name = nodeName;
 +        mapping.sourceStartPosition = new FilePosition(line, column);
 +        mapping.destStartPosition = new FilePosition(getCurrentLine(), getCurrentColumn());
 +        lastMapping = mapping;
 +    }
 +
++    public void startMapping(ISourceLocation node, ISourceLocation afterNode)
++    {
++        startMapping(node, afterNode.getEndLine(), afterNode.getEndColumn());
++    }
++
 +    public void endMapping(ISourceLocation node)
 +    {
 +        if (lastMapping == null)
 +        {
 +            throw new IllegalStateException("Cannot end mapping when a mapping has not been started");
 +        }
 +
 +        lastMapping.destEndPosition = new FilePosition(getCurrentLine(), getCurrentColumn());
 +        sourceMapMappings.add(lastMapping);
 +        lastMapping = null;
 +    }
 +
 +    /**
 +     * Adjusts the line numbers saved in the source map when a line should be
 +     * added during post processing.
 +     *
 +     * @param lineIndex
 +     */
 +    protected void addLineToMappings(int lineIndex)
 +    {
 +        for (SourceMapMapping mapping : sourceMapMappings)
 +        {
 +            FilePosition destStartPosition = mapping.destStartPosition;
 +            int startLine = destStartPosition.getLine();
 +            if(startLine > lineIndex)
 +            {
 +                mapping.destStartPosition = new FilePosition(startLine + 1, destStartPosition.getColumn());
 +                FilePosition destEndPosition = mapping.destEndPosition;
 +                mapping.destEndPosition = new FilePosition(destEndPosition.getLine() + 1, destEndPosition.getColumn());
 +            }
 +        }
 +    }
 +
 +    /**
 +     * Adjusts the line numbers saved in the source map when a line should be
 +     * removed during post processing.
 +     * 
 +     * @param lineIndex
 +     */
 +    protected void removeLineFromMappings(int lineIndex)
 +    {
 +        for (SourceMapMapping mapping : sourceMapMappings)
 +        {
 +            FilePosition destStartPosition = mapping.destStartPosition;
 +            int startLine = destStartPosition.getLine();
 +            if(startLine > lineIndex)
 +            {
 +                mapping.destStartPosition = new FilePosition(startLine - 1, destStartPosition.getColumn());
 +                FilePosition destEndPosition = mapping.destEndPosition;
 +                mapping.destEndPosition = new FilePosition(destEndPosition.getLine() - 1, destEndPosition.getColumn());
 +            }
 +        }
 +    }
 +
 +}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/beaf5b63/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSubEmitter.java
----------------------------------------------------------------------
diff --cc compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSubEmitter.java
index be0b9d1,0000000..f947af6
mode 100644,000000..100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSubEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/JSSubEmitter.java
@@@ -1,126 -1,0 +1,126 @@@
 +/*
 + *
 + *  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;
 +
 +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;
 +
 +public class JSSubEmitter
 +{
 +    private IJSEmitter emitter;
 +
 +    protected IJSEmitter getEmitter()
 +    {
 +        return emitter; 
 +    }
 +
 +    protected IBlockWalker getWalker()
 +    {
 +        return emitter.getWalker();
 +    }
 +    
 +    protected ICompilerProject getProject()
 +    {
 +        return emitter.getWalker().getProject();
 +    }
 +
 +    protected JSSessionModel getModel()
 +    {
 +        return emitter.getModel();
 +    }
 +
 +    public JSSubEmitter(IJSEmitter emitter)
 +    {
 +        this.emitter = emitter;
 +    }
 +
 +    protected void write(IEmitterTokens value)
 +    {
 +        emitter.write(value);
 +    }
 +
 +    protected void write(String value)
 +    {
 +        emitter.write(value);
 +    }
 +
 +    protected void writeToken(IEmitterTokens value)
 +    {
 +        emitter.writeToken(value);
 +    }
 +
 +    protected void writeToken(String value)
 +    {
 +        emitter.writeToken(value);
 +    }
 +
 +    protected void writeNewline()
 +    {
 +        emitter.writeNewline();
 +    }
 +
 +    protected void writeNewline(IEmitterTokens value)
 +    {
 +        emitter.writeNewline(value);
 +    }
 +
 +    protected void writeNewline(String value)
 +    {
 +        emitter.writeNewline(value);
 +    }
 +
 +    protected void writeNewline(String value, boolean pushIndent)
 +    {
 +        emitter.writeNewline(value, pushIndent);
 +    }
 +
 +    protected void indentPush()
 +    {
 +        emitter.indentPush();
 +    }
 +
 +    protected void indentPop()
 +    {
 +        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)
++    protected void startMapping(ISourceLocation node, ISourceLocation afterNode)
 +    {
-         emitter.startMapping(node, nodeBeforeMapping);
++        emitter.startMapping(node, afterNode);
 +    }
 +
 +    protected void endMapping(ISourceLocation node)
 +    {
 +        emitter.endMapping(node);
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/beaf5b63/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralContainerEmitter.java
----------------------------------------------------------------------
diff --cc compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralContainerEmitter.java
index d1d24fd,0000000..5e0fdce
mode 100644,000000..100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralContainerEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/LiteralContainerEmitter.java
@@@ -1,96 -1,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);
++            startMapping(node, node.getEndLine(), node.getEndColumn() - postFix.length());
 +            write(postFix);
 +            endMapping(node);
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/beaf5b63/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java
----------------------------------------------------------------------
diff --cc compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java
index d93d701,0000000..ad12b77
mode 100644,000000..100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/ObjectLiteralValuePairEmitter.java
@@@ -1,53 -1,0 +1,53 @@@
 +/*
 + *
 + *  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.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;
++        ISourceLocation location = (ISourceLocation) node;
 +
 +        IExpressionNode nameNode = node.getNameNode();
 +        getWalker().walk(nameNode);
 +
-         startMapping(sourceLocationNode, nameNode);
++        startMapping(location, nameNode);
 +        write(ASEmitterTokens.COLON);
-         endMapping(sourceLocationNode);
++        endMapping(location);
 +
 +        IExpressionNode valueNode = node.getValueNode();
 +        getWalker().walk(valueNode);
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/beaf5b63/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
----------------------------------------------------------------------
diff --cc compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
index f43b288,0000000..911a280
mode 100644,000000..100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/VarDeclarationEmitter.java
@@@ -1,123 -1,0 +1,131 @@@
 +/*
 + *
 + *  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.definitions.IDefinition;
 +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.flexjs.JSFlexJSEmitter;
 +import org.apache.flex.compiler.internal.tree.as.ChainedVariableNode;
 +import org.apache.flex.compiler.tree.as.IASNode;
 +import org.apache.flex.compiler.tree.as.IEmbedNode;
 +import org.apache.flex.compiler.tree.as.IExpressionNode;
 +import org.apache.flex.compiler.tree.as.IVariableNode;
 +
 +public class VarDeclarationEmitter extends JSSubEmitter implements
 +        ISubEmitter<IVariableNode>
 +{
 +
 +    public VarDeclarationEmitter(IJSEmitter emitter)
 +    {
 +        super(emitter);
 +    }
 +
 +    @Override
 +    public void emit(IVariableNode node)
 +    {
 +        // TODO (mschmalle) will remove this cast as more things get abstracted
 +        JSFlexJSEmitter fjs = (JSFlexJSEmitter) getEmitter();
 +
 +        getModel().getVars().add(node);
 +        
 +        if (!(node instanceof ChainedVariableNode) && !node.isConst())
 +        {
 +            fjs.emitMemberKeyword(node);
 +        }
 +
 +        IExpressionNode variableTypeNode = node.getVariableTypeNode();
-         if(variableTypeNode.getLine() >= 0)
++        boolean hasVariableType = variableTypeNode.getLine() >= 0;
++        if(hasVariableType)
 +        {
 +            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();
 +            startMapping(variableTypeNode, nameExpressionNode.getLine(),
 +                    nameExpressionNode.getColumn() + nameExpressionNode.getAbsoluteEnd() - nameExpressionNode.getAbsoluteStart());
 +        }
 +        IExpressionNode avnode = node.getAssignedValueNode();
 +        if (avnode != null)
 +        {
 +            IDefinition def = avnode.resolveType(getWalker().getProject());
 +
 +            String opcode = avnode.getNodeID().getParaphrase();
 +            if (opcode != "AnonymousFunction")
 +            {
 +                fjs.getDocEmitter().emitVarDoc(node, def, getWalker().getProject());
 +            }
 +        }
 +        else
 +        {
 +            fjs.getDocEmitter().emitVarDoc(node, null, getWalker().getProject());
 +        }
 +        endMapping(variableTypeNode);
 +
 +        if (!(node instanceof ChainedVariableNode) && node.isConst())
 +        {
 +            fjs.emitMemberKeyword(node);
 +        }
 +
 +        fjs.emitDeclarationName(node);
 +        if (avnode != null && !(avnode instanceof IEmbedNode))
 +        {
-             startMapping(node, node.getVariableTypeNode());
++            if (hasVariableType)
++            {
++                startMapping(node, node.getVariableTypeNode());
++            }
++            else
++            {
++                startMapping(node, node.getNameExpressionNode());
++            }
 +            write(ASEmitterTokens.SPACE);
 +            writeToken(ASEmitterTokens.EQUAL);
 +            endMapping(node);
 +            fjs.emitAssignedValue(avnode);
 +        }
 +
 +        if (!(node instanceof ChainedVariableNode))
 +        {
 +            // check for chained variables
 +            int len = node.getChildCount();
 +            for (int i = 0; i < len; i++)
 +            {
 +                IASNode child = node.getChild(i);
 +                if (child instanceof ChainedVariableNode)
 +                {
 +                    startMapping(node, node.getChild(i - 1));
 +                    writeToken(ASEmitterTokens.COMMA);
 +                    endMapping(node);
 +                    fjs.emitVarDeclaration((IVariableNode) child);
 +                }
 +            }
 +        }
 +    }
 +
 +}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/beaf5b63/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
----------------------------------------------------------------------
diff --cc compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
index 57ab17b,0000000..90aab08
mode 100644,000000..100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapExpressions.java
@@@ -1,716 -1,0 +1,755 @@@
 +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.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;
 +
 +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, 0, 1, 0, 1, 0, 4);
++        assertMapping(node, 0, 1, 0, 1, 0, 4); // +
 +    }
 +
 +    @Test
 +    public void testVisitBinaryOperatorNode_Minus()
 +    {
 +        IBinaryOperatorNode node = getBinaryNode("a - b");
 +        asBlockWalker.visitBinaryOperator(node);
-         assertMapping(node, 0, 1, 0, 1, 0, 4);
++        assertMapping(node, 0, 1, 0, 1, 0, 4); // -
 +    }
 +
 +    @Test
 +    public void testVisitBinaryOperatorNode_Divide()
 +    {
 +        IBinaryOperatorNode node = getBinaryNode("a / b");
 +        asBlockWalker.visitBinaryOperator(node);
-         assertMapping(node, 0, 1, 0, 1, 0, 4);
++        assertMapping(node, 0, 1, 0, 1, 0, 4); // /
 +    }
 +
 +    @Test
 +    public void testVisitBinaryOperatorNode_Modulo()
 +    {
 +        IBinaryOperatorNode node = getBinaryNode("a % b");
 +        asBlockWalker.visitBinaryOperator(node);
-         assertMapping(node, 0, 1, 0, 1, 0, 4);
++        assertMapping(node, 0, 1, 0, 1, 0, 4); // %
 +    }
 +
 +    @Test
 +    public void testVisitBinaryOperatorNode_Multiply()
 +    {
 +        IBinaryOperatorNode node = getBinaryNode("a * b");
 +        asBlockWalker.visitBinaryOperator(node);
-         assertMapping(node, 0, 1, 0, 1, 0, 4);
++        assertMapping(node, 0, 1, 0, 1, 0, 4); // *
 +    }
 +
 +    @Test
 +    public void testVisitUnaryOperatorNode_PostIncrement()
 +    {
 +        IUnaryOperatorNode node = getUnaryNode("a++");
 +        asBlockWalker.visitUnaryOperator(node);
-         assertMapping(node, 0, 1, 0, 1, 0, 3);
++        assertMapping(node, 0, 1, 0, 1, 0, 3); // ++
 +    }
 +
 +    @Test
 +    public void testVisitUnaryOperatorNode_PreIncrement()
 +    {
 +        IUnaryOperatorNode node = getUnaryNode("++a");
 +        asBlockWalker.visitUnaryOperator(node);
-         assertMapping(node, 0, 0, 0, 0, 0, 2);
++        assertMapping(node, 0, 0, 0, 0, 0, 2); // +
 +    }
 +
 +    @Test
 +    public void testVisitUnaryOperatorNode_PostDecrement()
 +    {
 +        IUnaryOperatorNode node = getUnaryNode("a--");
 +        asBlockWalker.visitUnaryOperator(node);
-         assertMapping(node, 0, 1, 0, 1, 0, 3);
++        assertMapping(node, 0, 1, 0, 1, 0, 3); // --
 +    }
 +
 +    @Test
 +    public void testVisitUnaryOperatorNode_PreDecrement()
 +    {
 +        IUnaryOperatorNode node = getUnaryNode("--a");
 +        asBlockWalker.visitUnaryOperator(node);
-         assertMapping(node, 0, 0, 0, 0, 0, 2);
++        assertMapping(node, 0, 0, 0, 0, 0, 2); // --
 +    }
 +
 +    //----------------------------------
 +    // Arithmetic compound assignment
 +    //----------------------------------
 +
 +    @Test
 +    public void testVisitBinaryOperatorNode_PlusAssignment()
 +    {
 +        IBinaryOperatorNode node = getBinaryNode("a += b");
 +        asBlockWalker.visitBinaryOperator(node);
 +        assertMapping(node, 0, 1, 0, 1, 0, 5);
 +    }
 +
 +    @Test
 +    public void testVisitBinaryOperatorNode_MinusAssignment()
 +    {
 +        IBinaryOperatorNode node = getBinaryNode("a -= b");
 +        asBlockWalker.visitBinaryOperator(node);
 +        assertMapping(node, 0, 1, 0, 1, 0, 5);
 +    }
 +
 +    @Test
 +    public void testVisitBinaryOperatorNode_DivideAssignment()
 +    {
 +        IBinaryOperatorNode node = getBinaryNode("a /= b");
 +        asBlockWalker.visitBinaryOperator(node);
 +        assertMapping(node, 0, 1, 0, 1, 0, 5);
 +    }
 +
 +    @Test
 +    public void testVisitBinaryOperatorNode_ModuloAssignment()
 +    {
 +        IBinaryOperatorNode node = getBinaryNode("a %= b");
 +        asBlockWalker.visitBinaryOperator(node);
 +        assertMapping(node, 0, 1, 0, 1, 0, 5);
 +    }
 +
 +    @Test
 +    public void testVisitBinaryOperatorNode_MultiplyAssignment()
 +    {
 +        IBinaryOperatorNode node = getBinaryNode("a *= b");
 +        asBlockWalker.visitBinaryOperator(node);
 +        assertMapping(node, 0, 1, 0, 1, 0, 5);
 +    }
 +
 +    //----------------------------------
 +    // Assignment
 +    //----------------------------------
 +
 +    @Test
 +    public void testVisitBinaryOperatorNode_Assignment()
 +    {
 +        IBinaryOperatorNode node = getBinaryNode("a = b");
 +        asBlockWalker.visitBinaryOperator(node);
-         assertMapping(node, 0, 1, 0, 1, 0, 4);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        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);
++        assertMapping(node, 0, 1, 0, 1, 0, 4); // =
++        assertMapping(node, 0, 1, 0, 5, 0, 9); // ||
 +    }
 +
 +    //----------------------------------
 +    // Other
 +    //----------------------------------
 +
 +    @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);
++        assertMapping(node, 0, 0, 0, 0, 0, 1); // a
++        assertMapping(node, 0, 1, 0, 1, 0, 2); // [
++        assertMapping(node, 0, 2, 0, 2, 0, 3); // b
++        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);
++        assertMapping(node, 0, 0, 0, 0, 0, 1);   // a
++        assertMapping(node, 0, 1, 0, 1, 0, 2);   // [
++        assertMapping(node, 0, 2, 0, 2, 0, 3);   // b
++        assertMapping(node, 0, 3, 0, 3, 0, 4);   // [
++        assertMapping(node, 0, 4, 0, 4, 0, 5);   // c
++        assertMapping(node, 0, 5, 0, 5, 0, 6);   // ]
++        assertMapping(node, 0, 6, 0, 6, 0, 7);   // [
++        assertMapping(node, 0, 7, 0, 7, 0, 8);   // d
++        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");
 +        asBlockWalker.visitBinaryOperator(node);
-         assertMapping(node, 0, 1, 0, 1, 0, 3);
++        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);
++        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);
++        assertMapping(node, 0, 0, 0, 0, 0, 7); // delete
 +    }
 +
 +    @Test
 +    public void testVisitMemberAccess_1()
 +    {
 +        IMemberAccessExpressionNode node = (IMemberAccessExpressionNode) getExpressionNode(
 +                "a.b", IMemberAccessExpressionNode.class);
 +        asBlockWalker.visitMemberAccessExpression(node);
-         assertMapping(node, 0, 1, 0, 1, 0, 2);
++        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);
++        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");
 +        asBlockWalker.visitBinaryOperator(node);
-         assertMapping(node, 0, 1, 0, 1, 0, 5);
++        assertMapping(node, 0, 1, 0, 1, 0, 5); // in
 +    }
 +
 +    @Test
 +    public void testVisitBinaryOperator_Instancof()
 +    {
 +        IBinaryOperatorNode node = getBinaryNode("a instanceof b");
 +        asBlockWalker.visitBinaryOperator(node);
-         assertMapping(node, 0, 1, 0, 1, 0, 13);
++        assertMapping(node, 0, 1, 0, 1, 0, 13); // instanceof
 +    }
 +
 +    @Test
 +    public void testVisitBinaryOperator_New()
 +    {
 +        IFunctionCallNode node = (IFunctionCallNode) getExpressionNode(
 +                "new Object()", IFunctionCallNode.class);
 +        asBlockWalker.visitFunctionCall(node);
-         assertMapping(node, 0, 0, 0, 0, 0, 4);
++        assertMapping(node, 0, 0, 0, 0, 0, 4); // new
 +    }
 +
 +    @Test
 +    public void testVisitObjectLiteral_1()
 +    {
 +        ObjectLiteralNode node = (ObjectLiteralNode) getExpressionNode(
 +                "a = {a:1}", ObjectLiteralNode.class);
 +        asBlockWalker.visitLiteral(node);
++        //{a: 1}
 +        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 testVisitObjectLiteral_4()
++    {
++        ObjectLiteralNode node = (ObjectLiteralNode) getExpressionNode(
++                "a = {a:1,\nb:2}", ObjectLiteralNode.class);
++        asBlockWalker.visitLiteral(node);
++        //{a:1, b:2}
++        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, 3, 0, 3, 0, 4);   // 1
++        assertMapping(node, 0, 4, 0, 4, 0, 6);   // ,
++        assertMapping(node, 1, 0, 0, 6, 0, 7);   // b
++        assertMapping(node, 1, 1, 0, 7, 0, 8);   // :
++        assertMapping(node, 1, 2, 0, 8, 0, 9);   // 2
++        assertMapping(node, 1, 3, 0, 9, 0, 10);  // }
++    }
++
++    @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, 1, 0, 1, 0, 2); // 0
 +        assertMapping(node, 0, 2, 0, 2, 0, 4); // ,
++        assertMapping(node, 0, 3, 0, 4, 0, 5); // 1
 +        assertMapping(node, 0, 4, 0, 5, 0, 7); // ,
++        assertMapping(node, 0, 5, 0, 7, 0, 8); // 2
 +        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 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 ] 
++        assertMapping(node, 1, 5, 0, 9, 0, 11);   // 45
++        assertMapping(node, 1, 7, 0, 11, 0, 12);  // 45
 +    }
 +
 +    @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);
++        //typeof(a)
++        assertMapping(node, 0, 0, 0, 0, 0, 7); // typeof(
++        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);
++        //typeof(a)
++        assertMapping(node, 0, 0, 0, 0, 0, 7); // typeof(
++        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);
++        assertMapping(node, 0, 0, 0, 0, 0, 5); // void
 +    }
 +
 +    @Test
 +    public void testVisitIterationFlowNode_BreakWithoutLabel()
 +    {
 +        IIterationFlowNode node = (IIterationFlowNode) getNode("break",
 +                IIterationFlowNode.class);
 +        asBlockWalker.visitIterationFlow(node);
-         assertMapping(node, 0, 0, 0, 0, 0, 5);
++        assertMapping(node, 0, 0, 0, 0, 0, 5); // break
 +    }
 +
 +    @Test
 +    public void testVisitIterationFlowNode_BreakWithLabel()
 +    {
 +        IIterationFlowNode node = (IIterationFlowNode) getNode("break label",
 +                IIterationFlowNode.class);
 +        asBlockWalker.visitIterationFlow(node);
-         assertMapping(node, 0, 0, 0, 0, 0, 6);
++        assertMapping(node, 0, 0, 0, 0, 0, 6);  // break
++        assertMapping(node, 0, 6, 0, 6, 0, 11); // label
 +    }
 +
 +    @Test
 +    public void testVisitIterationFlowNode_ContinueWithoutLabel()
 +    {
 +        IIterationFlowNode node = (IIterationFlowNode) getNode("continue",
 +                IIterationFlowNode.class);
 +        asBlockWalker.visitIterationFlow(node);
-         assertMapping(node, 0, 0, 0, 0, 0, 8);
++        assertMapping(node, 0, 0, 0, 0, 0, 8); // continue
 +    }
 +
 +    @Test
 +    public void testVisitIterationFlowNode_ContinueWithLabel()
 +    {
 +        IIterationFlowNode node = (IIterationFlowNode) getNode("continue label",
 +                IIterationFlowNode.class);
 +        asBlockWalker.visitIterationFlow(node);
-         assertMapping(node, 0, 0, 0, 0, 0, 9);
++        assertMapping(node, 0, 0, 0, 0, 0, 9); // continue
++        assertMapping(node, 0, 9, 0, 9, 0, 14); // label
 +    }
 +
 +    @Test
 +    public void testVisitReturnWithoutValue()
 +    {
 +        IReturnNode node = (IReturnNode) getNode("return", IReturnNode.class);
 +        asBlockWalker.visitReturn(node);
-         assertMapping(node, 0, 0, 0, 0, 0, 6);
++        assertMapping(node, 0, 0, 0, 0, 0, 6); // return
 +    }
 +
 +    @Test
 +    public void testVisitReturnWithValue()
 +    {
 +        IReturnNode node = (IReturnNode) getNode("return 0", IReturnNode.class);
 +        asBlockWalker.visitReturn(node);
-         assertMapping(node, 0, 0, 0, 0, 0, 7);
++        assertMapping(node, 0, 0, 0, 0, 0, 7); // return
++        assertMapping(node, 0, 7, 0, 7, 0, 8); // 0
 +    }
 +
 +    @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);
++        assertMapping(node, 0, 0, 0, 0, 0, 1); // a
++        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);
++        assertMapping(node, 0, 0, 0, 0, 0, 1); // a
++        assertMapping(node, 0, 1, 0, 1, 0, 2); // (
++        assertMapping(node, 0, 2, 0, 2, 0, 3); // b
++        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);
++        assertMapping(node, 0, 0, 0, 0, 0, 1); // a
++        assertMapping(node, 0, 1, 0, 1, 0, 2); // (
++        assertMapping(node, 0, 2, 0, 2, 0, 3); // b
++        assertMapping(node, 0, 3, 0, 3, 0, 5); // ,
++        assertMapping(node, 0, 5, 0, 5, 0, 6); // c
++        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/beaf5b63/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
----------------------------------------------------------------------
diff --cc compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
index 3c25d07,0000000..265b94c
mode 100644,000000..100644
--- a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
+++ b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/js/sourcemaps/TestSourceMapStatements.java
@@@ -1,171 -1,0 +1,307 @@@
 +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.IIfNode;
 +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);   // var
 +        assertMapping(node, 0, 4, 0, 21, 0, 22); // a
 +        assertMapping(node, 0, 5, 0, 4, 0, 21);  // (type)
 +    }
 +
 +    @Test
++    public void testVarDeclaration_withAssignedValue()
++    {
++        IVariableNode node = (IVariableNode) getNode("var a = 42;",
++                IVariableNode.class);
++        asBlockWalker.visitVariable(node);
++        //var /** @type {*} */ a = 42
++        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)
++        assertMapping(node, 0, 5, 0, 22, 0, 25); // =
++        assertMapping(node, 0, 8, 0, 25, 0, 27); // 42
++    }
++
++    @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);   // var
 +        assertMapping(node, 0, 4, 0, 26, 0, 27); // a
 +        assertMapping(node, 0, 5, 0, 4, 0, 26);  // :int
 +    }
 +
 +    @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);    // 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
 +    }
 +
 +    //----------------------------------
 +    // 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); // )
++        assertMapping(node, 0, 34, 0, 52, 0, 53); // {
++        assertMapping(node, 0, 43, 2, 0, 2, 1);   // }
 +    }
 +
 +    @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); // )
++        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);  // )
++        assertMapping(node, 0, 9, 0, 9, 0, 10); // {
++        assertMapping(node, 0, 18, 2, 0, 2, 1); // }
 +    }
 +
 +    @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); // )
++        assertMapping(node, 0, 23, 0, 41, 0, 42); // {
++        assertMapping(node, 0, 32, 2, 0, 2, 1);   // }
 +    }
 +
 +    @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); // )
 +    }
 +
++    //----------------------------------
++    // if ()
++    //----------------------------------
++
++    @Test
++    public void testVisitIf_1()
++    {
++        IIfNode node = (IIfNode) getNode("if (a) b++;", IIfNode.class);
++        asBlockWalker.visitIf(node);
++        //if (a)\n  b++;
++        assertMapping(node, 0, 0, 0, 0, 0, 4);    // if (
++        assertMapping(node, 0, 4, 0, 4, 0, 5);    // a
++        assertMapping(node, 0, 5, 0, 5, 0, 6);    // )
++    }
++
++    @Test
++    public void testVisitIf_2()
++    {
++        IIfNode node = (IIfNode) getNode("if (a) b++; else c++;", IIfNode.class);
++        asBlockWalker.visitIf(node);
++        //if (a)\n  b++;\nelse\n  c++;
++        assertMapping(node, 0, 0, 0, 0, 0, 4);    // if (
++        assertMapping(node, 0, 4, 0, 4, 0, 5);    // a
++        assertMapping(node, 0, 5, 0, 5, 0, 6);    // )
++        assertMapping(node, 0, 12, 2, 0, 2, 4);   // else
++    }
++
++    @Test
++    public void testVisitIf_4()
++    {
++        IIfNode node = (IIfNode) getNode(
++                "if (a) b++; else if (c) d++; else if(e) --f;", IIfNode.class);
++        asBlockWalker.visitIf(node);
++        //if (a)\n  b++;\nelse if (c)\n  d++;\nelse if (e)\n  --f;
++        assertMapping(node, 0, 0, 0, 0, 0, 4);    // if (
++        assertMapping(node, 0, 4, 0, 4, 0, 5);    // a
++        assertMapping(node, 0, 5, 0, 5, 0, 6);    // )
++        assertMapping(node, 0, 12, 2, 0, 2, 9);   // else if (
++        assertMapping(node, 0, 22, 2, 10, 2, 11); // )
++        assertMapping(node, 0, 29, 4, 0, 4, 9);   // else if (
++        assertMapping(node, 0, 38, 4, 10, 4, 11); // )
++    }
++
++    //----------------------------------
++    // if () { }
++    //----------------------------------
++
++    @Test
++    public void testVisitIf_1a()
++    {
++        IIfNode node = (IIfNode) getNode("if (a) { b++; }", IIfNode.class);
++        asBlockWalker.visitIf(node);
++        //if (a) {\n  b++;\n}
++        assertMapping(node, 0, 0, 0, 0, 0, 4);    // if (
++        assertMapping(node, 0, 4, 0, 4, 0, 5);    // a
++        assertMapping(node, 0, 5, 0, 5, 0, 7);    // )
++        assertMapping(node, 0, 7, 0, 7, 0, 8);    // {
++        assertMapping(node, 0, 14, 2, 0, 2, 1);   // }
++    }
++
++    @Test
++    public void testVisitIf_1b()
++    {
++        IIfNode node = (IIfNode) getNode("if (a) { b++; } else { c++; }",
++                IIfNode.class);
++        asBlockWalker.visitIf(node);
++        //if (a) {\n  b++;\n} else {\n  c++;\n}
++        assertMapping(node, 0, 0, 0, 0, 0, 4);    // if (
++        assertMapping(node, 0, 4, 0, 4, 0, 5);    // a
++        assertMapping(node, 0, 5, 0, 5, 0, 7);    // )
++        assertMapping(node, 0, 7, 0, 7, 0, 8);    // {
++        assertMapping(node, 0, 14, 2, 0, 2, 1);   // }
++        assertMapping(node, 0, 16, 2, 2, 2, 7);   // else
++        assertMapping(node, 0, 21, 2, 7, 2, 8);   // {
++        assertMapping(node, 0, 28, 4, 0, 4, 1);   // }
++    }
++
++    @Test
++    public void testVisitIf_1c()
++    {
++        IIfNode node = (IIfNode) getNode(
++                "if (a) { b++; } else if (b) { c++; } else { d++; }",
++                IIfNode.class);
++        asBlockWalker.visitIf(node);
++        //if (a) {\n  b++;\n} else if (b) {\n  c++;\n} else {\n  d++;\n}
++        assertMapping(node, 0, 0, 0, 0, 0, 4);    // if (
++        assertMapping(node, 0, 4, 0, 4, 0, 5);    // a
++        assertMapping(node, 0, 5, 0, 5, 0, 7);    // )
++        assertMapping(node, 0, 7, 0, 7, 0, 8);    // {
++        assertMapping(node, 0, 14, 2, 0, 2, 1);   // }
++        assertMapping(node, 0, 16, 2, 2, 2, 11);  // else if(
++        assertMapping(node, 0, 26, 2, 12, 2, 14); // )
++        assertMapping(node, 0, 28, 2, 14, 2, 15); // {
++        assertMapping(node, 0, 35, 4, 0, 4, 1);   // }
++        assertMapping(node, 0, 37, 4, 2, 4, 7);   // else
++        assertMapping(node, 0, 42, 4, 7, 4, 8);   // {
++        assertMapping(node, 0, 49, 6, 0, 6, 1);   // {
++    }
++
++    @Test
++    public void testVisitIf_3()
++    {
++        IIfNode node = (IIfNode) getNode(
++                "if (a) b++; else if (c) d++; else --e;", IIfNode.class);
++        asBlockWalker.visitIf(node);
++        //if (a)\n  b++;\nelse if (c)\n  d++;\nelse\n  --e;
++        assertMapping(node, 0, 0, 0, 0, 0, 4);     // if (
++        assertMapping(node, 0, 4, 0, 4, 0, 5);     // a
++        assertMapping(node, 0, 5, 0, 5, 0, 6);     // )
++        assertMapping(node, 0, 12, 2, 0, 2, 9);    // else if (
++        assertMapping(node, 0, 21, 2, 9, 2, 10);   // c
++        assertMapping(node, 0, 22, 2, 10, 2, 11);  // )
++        assertMapping(node, 0, 29, 4, 0, 4, 4);    // else
++    }
++
 +    protected IBackend createBackend()
 +    {
 +        return new FlexJSBackend();
 +    }
 +}