Merge
authorlana
Thu, 19 Mar 2015 16:13:54 -0700
changeset 29542 8a8ef9c75d2e
parent 29533 fb7bd0624eee (current diff)
parent 29541 efc10427bddc (diff)
child 29543 4d9f8f8b69a4
Merge
--- a/nashorn/samples/findwith.js	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/samples/findwith.js	Thu Mar 19 16:13:54 2015 -0700
@@ -52,7 +52,6 @@
 var SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES5_1");
 
 var parser = Parser.create("-scripting", "--const-as-var");
-var protoFound = false;
 
 function checkFile(file) {
     // print("checking " + file);
@@ -92,7 +91,3 @@
 } else {
     checkFile(file);
 }
-
-if (protoFound) {
-    print("__proto__ is non-standard. Use Object.get/setPrototypeOf instead");
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/prettyprinter.js	Thu Mar 19 16:13:54 2015 -0700
@@ -0,0 +1,642 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * This script is a AST pretty printer for ECMAScript. It uses
+ * Nashorn parser API to parser given script and uses tree visitor
+ * to pretty print the AST to stdout as a script string.
+ */
+
+var File = Java.type("java.io.File");
+var file = arguments.length == 0? new File(__FILE__) : new File(arguments[0]);
+if (! file.isFile()) {
+    print(arguments[0] + " is not a file");
+    exit(1);
+}
+
+// Java classes used
+var ArrayAccess = Java.type("jdk.nashorn.api.tree.ArrayAccessTree");
+var Block = Java.type("jdk.nashorn.api.tree.BlockTree");
+var FunctionDeclaration = Java.type("jdk.nashorn.api.tree.FunctionDeclarationTree");
+var FunctionExpression = Java.type("jdk.nashorn.api.tree.FunctionExpressionTree");
+var Identifier = Java.type("jdk.nashorn.api.tree.IdentifierTree");
+var Kind = Java.type("jdk.nashorn.api.tree.Tree.Kind");
+var MemberSelect = Java.type("jdk.nashorn.api.tree.MemberSelectTree");
+var ObjectLiteral = Java.type("jdk.nashorn.api.tree.ObjectLiteralTree");
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES5_1");
+var System = Java.type("java.lang.System");
+
+// make a nashorn parser
+var parser = Parser.create("-scripting", "--const-as-var");
+
+// symbols for nashorn operators
+var operatorSymbols = {
+    POSTFIX_INCREMENT: "++", 
+    POSTFIX_DECREMENT: "--",
+    PREFIX_INCREMENT: "++", 
+    PREFIX_DECREMENT: "--",
+    UNARY_PLUS: "+",
+    UNARY_MINUS: "-",
+    BITWISE_COMPLEMENT: "~",
+    LOGICAL_COMPLEMENT: "!",
+    DELETE: "delete ",
+    TYPEOF: "typeof ",
+    VOID: "void ", 
+    COMMA: ",",
+    MULTIPLY: "*", 
+    DIVIDE: "/", 
+    REMINDER: "%", 
+    PLUS: "+",
+    MINUS: "-",
+    LEFT_SHIFT: "<<",
+    RIGHT_SHIFT: ">>",
+    UNSIGNED_RIGHT_SHIFT: ">>>",
+    LESS_THAN: "<",
+    GREATER_THAN: ">",
+    LESS_THAN_EQUAL: "<=",
+    GREATER_THAN_EQUAL: ">=", 
+    IN: "in", 
+    EQUAL_TO: "==",
+    NOT_EQUAL_TO: "!=",
+    STRICT_EQUAL_TO: "===",
+    STRICT_NOT_EQUAL_TO: "!==",
+    AND: "&",
+    XOR: "^",
+    OR: "|", 
+    CONDITIONAL_AND: "&&", 
+    CONDITIONAL_OR: "||",
+    MULTIPLY_ASSIGNMENT: "*=",
+    DIVIDE_ASSIGNMENT: "/=",
+    REMINDER_ASSIGNMENT: "%=",
+    PLUS_ASSIGNMENT: "+=",
+    MINUS_ASSIGNMENT: "-=",
+    LEFT_SHIFT_ASSIGNMENT: "<<=",
+    RIGHT_SHIFT_ASSIGNMENT: ">>=",
+    UNSIGNED_RIGHT_SHIFT_ASSIGNMENT: ">>>=",
+    AND_ASSIGNMENT: "&=",
+    XOR_ASSIGNMENT: "^=",
+    OR_ASSIGNMENT: "|="
+};
+
+function operatorOf(kind) {
+     var name = kind.name();
+     if (name in operatorSymbols) {
+         return operatorSymbols[name];
+     }
+     throw "invalid operator: " + name;
+}
+
+var gprint = print;
+
+function prettyPrint(file) {
+    var ast = parser.parse(file, gprint);
+    if (!ast) {
+        // failed to parse. don't print anything!
+        return;
+    }
+
+    // AST visitor
+    var visitor;
+    // current indent level
+    var indentLevel = 0;
+    var out = System.out;
+
+    function print(obj) {
+        out.print(String(obj));
+    }
+
+    function println(obj) {
+        obj?  out.println(String(obj)) : out.println();
+    }
+
+    // semicolon and end-of-line
+    function eol() {
+        println(";");
+    }
+
+    // print indentation - 4 spaces per level
+    function indent() {
+        for (var i = 0; i < indentLevel; i++) {
+            // 4 spaces per indent level
+            print("    ");
+        }
+    }
+
+    // escape string literals
+    function escapeString(str) {
+        // FIXME: incomplete, revisit again!
+        return str.replace(/[\\"']/g, '\\$&')
+    }
+
+    // print a single statement (could be a block too)
+    function printStatement(stat, extra, end) {
+        if (stat instanceof Block) {
+            println(" {");
+            printStatements(stat.statements, extra);
+            indent();
+            print('}');
+            typeof end != "undefined"? print(end) : println();
+        } else {
+            println();
+            indentLevel++;
+            try {
+                stat.accept(visitor, extra);
+            } finally {
+                indentLevel--;
+            }
+        }
+    }
+
+    // print a statement list
+    function printStatements(stats, extra) {
+        indentLevel++;
+        try {
+            for each (var stat in stats) {
+                stat.accept(visitor, extra);
+            }
+        } finally {
+            indentLevel--;
+        }
+    }
+
+    // function arguments, array literal elements.
+    function printCommaList(args, extra) {
+        var len = args.length;
+        for (var i = 0; i < len; i++) {
+            args[i].accept(visitor, extra);
+            if (i != len - 1) {
+                print(", ");
+            }
+        }
+    }
+
+    // print function declarations and expressions
+    function printFunction(func, extra, end) {
+        // extra lines around function declarations for clarity
+        var funcDecl = (func instanceof FunctionDeclaration);
+        if (funcDecl) {
+            println();
+            indent();
+        }
+        print("function ");
+        if (func.name) {
+            print(func.name);
+        }
+        printFunctionBody(func, extra, end);
+        if (funcDecl) {
+            println();
+        }
+    }
+
+    // print function declaration/expression body
+    function printFunctionBody(func, extra, end) {
+        print('(');
+        var params = func.parameters;
+        if (params) {
+            printCommaList(params);
+        }
+        print(')');
+        printStatement(func.body, extra, end);
+    }
+
+    // print object literal property
+    function printProperty(node, extra, comma) {
+        var key = node.key;
+        var val = node.value;
+        var getter = node.getter;
+        var setter = node.setter;
+
+        if (getter) {
+            print("get ");
+        } else if (setter) {
+            print("set ");
+        }
+
+        if (typeof key == "string") {
+            print(key);
+        } else {
+            key.accept(visitor, extra);
+        }
+
+        if (val) {
+            print(": ");
+            if (val instanceof FunctionExpression) {
+                printFunction(val, extra, comma? ',' : undefined);
+            } else {
+                val.accept(visitor, extra);
+                if (comma) print(',');
+            }
+        } else if (getter) {
+            printFunctionBody(getter, extra, comma? ',' : undefined);
+        } else if (setter) {
+            printFunctionBody(setter, extra, comma? ',' : undefined);
+        }
+    }
+
+
+    ast.accept(visitor = new (Java.extend(SimpleTreeVisitor)) {
+         visitAssignment: function(node, extra) {
+             node.variable.accept(visitor, extra);
+             print(" = ");
+             node.expression.accept(visitor, extra);
+         },
+
+         visitCompoundAssignment: function(node, extra) {
+             node.variable.accept(visitor, extra);
+             print(' ' + operatorOf(node.kind) + ' ');
+             node.expression.accept(visitor, extra);
+         },
+
+         visitBinary: function(node, extra) {
+             node.leftOperand.accept(visitor, extra);
+             print(' ' + operatorOf(node.kind) + ' ');
+             node.rightOperand.accept(visitor, extra);
+         },
+
+         visitBlock: function(node, extra) {
+             indent();
+             println('{');
+             printStatements(node.statements, extra);
+             indent();
+             println('}');
+         },
+
+         visitBreak: function(node, extra) {
+             indent();
+             print("break");
+             if (node.label) {
+                 print(' ' + node.label);
+             }
+             eol();
+         },
+
+         visitCase: function(node, extra) {
+             var expr = node.expression;
+             indent();
+             if (expr) {
+                 print("case ");
+                 expr.accept(visitor, extra);
+                 println(':');
+             } else {
+                 println("default:");
+             }
+
+             printStatements(node.statements, extra);
+         },
+
+         visitCatch: function(node, extra) {
+             indent();
+             print("catch (" + node.parameter.name);
+             var cond = node.condition;
+             if (cond) {
+                 print(" if ");
+                 cond.accept(visitor, extra);
+             }
+             print(')');
+             printStatement(node.block);
+         },
+
+         visitConditionalExpression: function(node, extra) {
+             print('(');
+             node.condition.accept(visitor, extra);
+             print(" ? ");
+             node.trueExpression.accept(visitor, extra);
+             print(" : ");
+             node.falseExpression.accept(visitor, extra);
+             print(')');
+         },
+
+         visitContinue: function(node, extra) {
+             indent();
+             print("continue");
+             if (node.label) {
+                 print(' ' + node.label);
+             }
+             eol();
+         },
+
+         visitDebugger: function(node, extra) {
+             indent();
+             print("debugger");
+             eol();
+         },
+
+         visitDoWhileLoop: function(node, extra) {
+             indent();
+             print("do");
+             printStatement(node.statement, extra);
+             indent();
+             print("while (");
+             node.condition.accept(visitor, extra);
+             print(')');
+             eol();
+         },
+
+         visitExpressionStatement: function(node, extra) {
+             indent();
+             var expr = node.expression;
+             var objLiteral = expr instanceof ObjectLiteral;
+             if (objLiteral) {
+                 print('(');
+             }
+
+             expr.accept(visitor, extra);
+             if (objLiteral) {
+                 print(')');
+             }
+             eol();
+         },
+
+         visitForLoop: function(node, extra) {
+             indent();
+             print("for (");
+             if (node.initializer) {
+                node.initializer.accept(visitor, extra);
+             }
+
+             print(';');
+             if (node.condition) {
+                node.condition.accept(visitor, extra);
+             }
+             print(';');
+             if (node.update) {
+                node.update.accept(visitor, extra);
+             }
+             print(')');
+             printStatement(node.statement);
+         },
+
+         visitForInLoop: function(node, extra) {
+             indent();
+             print("for ");
+             if (node.forEach) {
+                 print("each ");
+             }
+             print('(');
+             node.variable.accept(visitor, extra);
+             print(" in ");
+             node.expression.accept(visitor, extra);
+             print(')');
+             printStatement(node.statement);
+         },
+
+         visitFunctionCall: function(node, extra) {
+             var func = node.functionSelect;
+             // We need parens around function selected
+             // in many non-simple cases. Eg. function
+             // expression created and called immediately.
+             // Such parens are not preserved in AST and so
+             // introduce here.
+             var simpleFunc =
+                 (func instanceof ArrayAccess) ||
+                 (func instanceof Identifier) ||
+                 (func instanceof MemberSelect);
+             if (! simpleFunc) {
+                 print('(');
+             }
+             func.accept(visitor, extra);
+             if (! simpleFunc) {
+                 print(')');
+             }
+             print('(');
+             printCommaList(node.arguments, extra);
+             print(')');
+         },
+
+         visitFunctionDeclaration: function(node, extra) {
+             printFunction(node, extra);
+         },
+
+         visitFunctionExpression: function(node, extra) {
+             printFunction(node, extra);
+         },
+
+         visitIdentifier: function(node, extra) {
+             print(node.name);
+         },
+
+         visitIf: function(node, extra) {
+             indent();
+             print("if (");
+             node.condition.accept(visitor, extra);
+             print(')');
+             printStatement(node.thenStatement);
+             var el = node.elseStatement;
+             if (el) {
+                 indent();
+                 print("else");
+                 printStatement(el);
+             }
+         },
+
+         visitArrayAccess: function(node, extra) {
+             node.expression.accept(visitor, extra);
+             print('[');
+             node.index.accept(visitor, extra);
+             print(']');
+         },
+
+         visitArrayLiteral: function(node, extra) {
+             print('[');
+             printCommaList(node.elements);
+             print(']');
+         },
+
+         visitLabeledStatement: function(node, extra) {
+             indent();
+             print(node.label);
+             print(':');
+             printStatement(node.statement);
+         },
+
+         visitLiteral: function(node, extra) {
+             var val = node.value;
+             if (typeof val == "string") {
+                 print("'" + escapeString(val) + "'");
+             } else {
+                 print(val);
+             }
+         },
+
+         visitParenthesized: function(node, extra) {
+             print('(');
+             node.expression.accept(visitor, extra);
+             print(')');
+         },
+
+         visitReturn: function(node, extra) {
+             indent();
+             print("return");
+             if (node.expression) {
+                 print(' ');
+                 node.expression.accept(visitor, extra);
+             }
+             eol();
+         },
+
+         visitMemberSelect: function(node, extra) {
+             node.expression.accept(visitor, extra);
+             print('.' + node.identifier);
+         },
+
+         visitNew: function(node, extra) {
+             print("new ");
+             node.constructorExpression.accept(visitor, extra);
+         },
+
+         visitObjectLiteral: function(node, extra) {
+             println('{');
+             indentLevel++;
+             try {
+                 var props = node.properties;
+                 var len = props.length;
+                 for (var p = 0; p < len; p++) {
+                     var last = (p == len - 1);
+                     indent();
+                     printProperty(props[p], extra, !last);
+                     println();
+                 }
+             } finally {
+                 indentLevel--;
+             }
+             indent();
+             print('}');
+         },
+
+         visitRegExpLiteral: function(node, extra) {
+             print('/' + node.pattern + '/');
+             print(node.options);
+         },
+
+         visitEmptyStatement: function(node, extra) {
+             indent();
+             eol();
+         },
+
+         visitSwitch: function(node, extra) {
+             indent();
+             print("switch (");
+             node.expression.accept(visitor, extra);
+             println(") {");
+             indentLevel++;
+             try {
+                 for each (var c in node.cases) {
+                     c.accept(visitor, extra);
+                 }
+             } finally {
+                 indentLevel--;
+             }
+             indent();
+             println('}');
+         },
+
+         visitThrow: function(node, extra) {
+             indent();
+             print("throw ");
+             node.expression.accept(visitor, extra);
+             eol();
+         },
+
+         visitCompilationUnit: function(node, extra) {
+             for each (var stat in node.sourceElements) {
+                 stat.accept(visitor, extra);
+             }
+         },
+
+         visitTry: function(node, extra) {
+             indent();
+             print("try");
+             printStatement(node.block);
+             var catches = node.catches;
+             for each (var c in catches) {
+                 c.accept(visitor, extra);
+             }
+             var finallyBlock = node.finallyBlock;
+             if (finallyBlock) {
+                 indent();
+                 print("finally");
+                 printStatement(finallyBlock);
+             }
+         },
+
+         visitInstanceOf: function(node, extra) {
+             node.expression.accept(visitor, extra);
+             print(" instanceof ");
+             node.type.accept(visitor, extra);
+         },
+
+         visitUnary: function(node, extra) {
+             var kind = node.kind;
+             var prefix = kind != Kind.POSTFIX_INCREMENT && kind != Kind.POSTFIX_DECREMENT;
+             if (prefix) {
+                 print(operatorOf(kind));
+             }
+             node.expression.accept(visitor, extra);
+             if (!prefix) {
+                 print(operatorOf(kind));
+             }
+         },
+
+         visitVariable: function(node, extra) {
+             indent();
+             print("var " + node.name);
+             var init = node.initializer;
+             if (init) {
+                 print(" = ");
+                 if (init instanceof FunctionExpression) {
+                     printFunction(init, extra, "");
+                 } else {
+                     init.accept(visitor, extra);
+                 }
+             }
+             eol();
+         },
+
+         visitWhileLoop: function(node, extra) {
+             indent();
+             print("while (");
+             node.condition.accept(visitor, extra);
+             print(')');
+             printStatement(node.statement);
+         },
+
+         visitWith: function(node, extra) {
+             indent();
+             print("with (");
+             node.scope.accept(visitor, extra);
+             print(')');
+             printStatement(node.statement);
+         }
+    }, null);
+}
+
+prettyPrint(file);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTree.java	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/DoWhileLoopTree.java	Thu Mar 19 16:13:54 2015 -0700
@@ -44,6 +44,7 @@
      *
      * @return the condition expression
      */
+    @Override
     ExpressionTree getCondition();
 
     /**
@@ -51,5 +52,6 @@
      *
      * @return the statement
      */
+    @Override
     StatementTree getStatement();
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTree.java	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ForInLoopTree.java	Thu Mar 19 16:13:54 2015 -0700
@@ -57,6 +57,7 @@
      *
      * @return the statement
      */
+    @Override
     StatementTree getStatement();
 
     /**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTreeImpl.java	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/FunctionDeclarationTreeImpl.java	Thu Mar 19 16:13:54 2015 -0700
@@ -43,7 +43,7 @@
         assert node.getInit() instanceof FunctionNode : "function expected";
         funcNode = (FunctionNode)node.getInit();
         assert funcNode.isDeclared() : "function declaration expected";
-        funcName = node.getName().getName();
+        funcName = funcNode.isAnonymous()? null : node.getName().getName();
         this.params = params;
         this.body = body;
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java	Thu Mar 19 16:13:54 2015 -0700
@@ -25,6 +25,7 @@
 package jdk.nashorn.api.tree;
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.List;
 import jdk.nashorn.internal.ir.AccessNode;
 import jdk.nashorn.internal.ir.BinaryNode;
@@ -92,7 +93,7 @@
 
         final Block body = node.getBody();
         return new CompilationUnitTreeImpl(node,
-                translateStats(body != null? body.getStatements() : null));
+                translateStats(body != null? getOrderedStatements(body.getStatements()) : null));
     }
 
     @Override
@@ -103,25 +104,7 @@
 
     @Override
     public boolean enterBlock(final Block block) {
-        // FIXME: revisit this!
-        if (block.isSynthetic()) {
-            final int statCount = block.getStatementCount();
-            switch (statCount) {
-                case 0: {
-                    final EmptyNode emptyNode = new EmptyNode(-1, block.getToken(), block.getFinish());
-                    curStat = new EmptyStatementTreeImpl(emptyNode);
-                    return false;
-                }
-                case 1: {
-                    curStat = translateStat(block.getStatements().get(0));
-                    return false;
-                }
-            }
-        }
-
-        curStat = new BlockTreeImpl(block,
-            translateStats(block.getStatements()));
-        return false;
+        return handleBlock(block, false);
     }
 
     @Override
@@ -245,7 +228,7 @@
 
         final List<? extends ExpressionTree> paramTrees
                     = translateExprs(functionNode.getParameters());
-        final BlockTree blockTree = (BlockTree) translateBlock(functionNode.getBody());
+        final BlockTree blockTree = (BlockTree) translateBlock(functionNode.getBody(), true);
         curExpr = new FunctionExpressionTreeImpl(functionNode, paramTrees, blockTree);
 
         return false;
@@ -420,7 +403,7 @@
 
             final List<? extends ExpressionTree> paramTrees
                     = translateExprs(funcNode.getParameters());
-            final BlockTree blockTree = (BlockTree) translateBlock(funcNode.getBody());
+            final BlockTree blockTree = (BlockTree) translateBlock(funcNode.getBody(), true);
             curStat = new FunctionDeclarationTreeImpl(varNode, paramTrees, blockTree);
         } else {
             curStat = new VariableTreeImpl(varNode, translateExpr(initNode));
@@ -453,14 +436,51 @@
     }
 
     private StatementTree translateBlock(final Block blockNode) {
+        return translateBlock(blockNode, false);
+    }
+
+    private StatementTree translateBlock(final Block blockNode, final boolean sortStats) {
         if (blockNode == null) {
             return null;
         }
         curStat = null;
-        blockNode.accept(this);
+        handleBlock(blockNode, sortStats);
         return curStat;
     }
 
+    private boolean handleBlock(final Block block, final boolean sortStats) {
+        // FIXME: revisit this!
+        if (block.isSynthetic()) {
+            final int statCount = block.getStatementCount();
+            switch (statCount) {
+                case 0: {
+                    final EmptyNode emptyNode = new EmptyNode(-1, block.getToken(), block.getFinish());
+                    curStat = new EmptyStatementTreeImpl(emptyNode);
+                    return false;
+                }
+                case 1: {
+                    curStat = translateStat(block.getStatements().get(0));
+                    return false;
+                }
+                default: {
+                    // fall through
+                    break;
+                }
+            }
+        }
+
+        final List<? extends Statement> stats = block.getStatements();
+        curStat = new BlockTreeImpl(block,
+            translateStats(sortStats? getOrderedStatements(stats) : stats));
+        return false;
+    }
+
+    private List<? extends Statement> getOrderedStatements(final List<? extends Statement> stats) {
+        final List<? extends Statement> statList = new ArrayList<>(stats);
+        statList.sort(Comparator.comparingInt(Node::getSourceOrder));
+        return statList;
+    }
+
     private List<? extends StatementTree> translateStats(final List<? extends Statement> stats) {
         if (stats == null) {
             return null;
@@ -511,7 +531,7 @@
         return curStat;
     }
 
-    private IdentifierTree translateIdent(final IdentNode ident) {
+    private static IdentifierTree translateIdent(final IdentNode ident) {
         return new IdentifierTreeImpl(ident);
     }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParserImpl.java	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/ParserImpl.java	Thu Mar 19 16:13:54 2015 -0700
@@ -139,7 +139,7 @@
         }
     }
 
-    private CompilationUnitTree translate(final FunctionNode node) {
+    private static CompilationUnitTree translate(final FunctionNode node) {
         return new IRTranslator().translate(node);
     }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTree.java	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/WhileLoopTree.java	Thu Mar 19 16:13:54 2015 -0700
@@ -43,6 +43,7 @@
      *
      * @return the condition expression
      */
+    @Override
     ExpressionTree getCondition();
 
     /**
@@ -50,5 +51,6 @@
      *
      * @return the statement contained
      */
+    @Override
     StatementTree getStatement();
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java	Thu Mar 19 16:13:54 2015 -0700
@@ -183,6 +183,17 @@
         return start;
     }
 
+    /**
+     * Integer to sort nodes in source order. This order is
+     * used by parser API to sort statements in correct order.
+     * By default, this is the start position of this node.
+     *
+     * @return int code to sort this node.
+     */
+    public int getSourceOrder() {
+        return getStart();
+    }
+
     @Override
     protected Object clone() {
         try {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java	Thu Mar 19 16:13:54 2015 -0700
@@ -45,6 +45,13 @@
     /** Is this a var statement (as opposed to a "var" in a for loop statement) */
     private final int flags;
 
+    /**
+     * source order id to be used for this node. If this is -1, then we
+     * the default which is start position of this node. See also the
+     * method Node::getSourceOrder.
+     */
+    private final int sourceOrder;
+
     /** Flag for ES6 LET declaration */
     public static final int IS_LET                       = 1 << 0;
 
@@ -71,6 +78,7 @@
 
     private VarNode(final VarNode varNode, final IdentNode name, final Expression init, final int flags) {
         super(varNode);
+        this.sourceOrder = -1;
         this.name = init == null ? name : name.setIsInitializedHere();
         this.init = init;
         this.flags = flags;
@@ -79,22 +87,42 @@
     /**
      * Constructor
      *
-     * @param lineNumber line number
-     * @param token      token
-     * @param finish     finish
-     * @param name       name of variable
-     * @param init       init node or null if just a declaration
-     * @param flags      flags
+     * @param lineNumber  line number
+     * @param token       token
+     * @param finish      finish
+     * @param name        name of variable
+     * @param init        init node or null if just a declaration
+     * @param flags       flags
      */
     public VarNode(final int lineNumber, final long token, final int finish, final IdentNode name, final Expression init, final int flags) {
+        this(lineNumber, token, -1, finish, name, init, flags);
+    }
+
+    /**
+     * Constructor
+     *
+     * @param lineNumber  line number
+     * @param token       token
+     * @param sourceOrder source order
+     * @param finish      finish
+     * @param name        name of variable
+     * @param init        init node or null if just a declaration
+     * @param flags       flags
+     */
+    public VarNode(final int lineNumber, final long token, final int sourceOrder, final int finish, final IdentNode name, final Expression init, final int flags) {
         super(lineNumber, token, finish);
-
+        this.sourceOrder = sourceOrder;
         this.name  = init == null ? name : name.setIsInitializedHere();
         this.init  = init;
         this.flags = flags;
     }
 
     @Override
+    public int getSourceOrder() {
+        return sourceOrder == -1? super.getSourceOrder() : sourceOrder;
+    }
+
+    @Override
     public boolean isAssignment() {
         return hasInit();
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Thu Mar 19 16:13:54 2015 -0700
@@ -26,7 +26,9 @@
 package jdk.nashorn.internal.objects;
 
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
+
 import java.nio.ByteBuffer;
+
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Constructor;
 import jdk.nashorn.internal.objects.annotations.Function;
@@ -101,7 +103,7 @@
         }
 
         if (args.length == 0) {
-            throw new RuntimeException("missing length argument");
+            return new NativeArrayBuffer(0);
         }
 
         return new NativeArrayBuffer(JSType.toInt32(args[0]));
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java	Thu Mar 19 16:13:54 2015 -0700
@@ -1066,6 +1066,10 @@
      * @param isStatement True if a statement (not used in a FOR.)
      */
     private List<VarNode> variableStatement(final TokenType varType, final boolean isStatement) {
+        return variableStatement(varType, isStatement, -1);
+    }
+
+    private List<VarNode> variableStatement(final TokenType varType, final boolean isStatement, final int sourceOrder) {
         // VAR tested in caller.
         next();
 
@@ -1104,7 +1108,7 @@
             }
 
             // Allocate var node.
-            final VarNode var = new VarNode(varLine, varToken, finish, name.setIsDeclaredHere(), init, varFlags);
+            final VarNode var = new VarNode(varLine, varToken, sourceOrder, finish, name.setIsDeclaredHere(), init, varFlags);
             vars.add(var);
             appendStatement(var);
 
@@ -1211,6 +1215,10 @@
     private void forStatement() {
         final long forToken = token;
         final int forLine = line;
+        // start position of this for statement. This is used
+        // for sort order for variables declared in the initialzer
+        // part of this 'for' statement (if any).
+        final int forStart = Token.descPosition(forToken);
         // When ES6 for-let is enabled we create a container block to capture the LET.
         final int startLine = start;
         final ParserContextBlockNode outer = useBlockScope() ? newBlock() : null;
@@ -1243,7 +1251,7 @@
             switch (type) {
             case VAR:
                 // Var declaration captured in for outer block.
-                vars = variableStatement(type, false);
+                vars = variableStatement(type, false, forStart);
                 break;
             case SEMICOLON:
                 break;
@@ -1253,12 +1261,12 @@
                         flags |= ForNode.PER_ITERATION_SCOPE;
                     }
                     // LET/CONST declaration captured in container block created above.
-                    vars = variableStatement(type, false);
+                    vars = variableStatement(type, false, forStart);
                     break;
                 }
                 if (env._const_as_var && type == CONST) {
                     // Var declaration captured in for outer block.
-                    vars = variableStatement(TokenType.VAR, false);
+                    vars = variableStatement(TokenType.VAR, false, forStart);
                     break;
                 }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java	Thu Mar 19 16:13:54 2015 -0700
@@ -27,7 +27,6 @@
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT;
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.isValid;
-
 import java.lang.invoke.CallSite;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
@@ -595,7 +594,7 @@
      * switchpoint has been invalidated by a {@code RewriteException} triggered on another thread for this function.
      * This is not a problem, though, as these switch points are always used to produce call sites that fall back to
      * relinking when they are invalidated, and in this case the execution will end up here again. What this method
-     * basically does is reduce such busy-loop relinking while the function is being recompiled on a different thread.
+     * basically does is minimize such busy-loop relinking while the function is being recompiled on a different thread.
      * @param invocationSupplier the supplier that constructs the actual invocation method handle; should use the
      * {@code CompiledFunction} method itself in some capacity.
      * @return a tuple object containing the method handle as created by the supplier and an optimistic assumptions
@@ -603,27 +602,20 @@
      * function can't be further deoptimized).
      */
     private synchronized HandleAndAssumptions getValidOptimisticInvocation(final Supplier<MethodHandle> invocationSupplier) {
-        for(int i = 0; i < 2; ++i) {
+        for(;;) {
             final MethodHandle handle = invocationSupplier.get();
             final SwitchPoint assumptions = canBeDeoptimized() ? optimismInfo.optimisticAssumptions : null;
-            if(i == 0 && assumptions != null && assumptions.hasBeenInvalidated()) {
+            if(assumptions != null && assumptions.hasBeenInvalidated()) {
                 // We can be in a situation where one thread is in the middle of a deoptimizing compilation when we hit
                 // this and thus, it has invalidated the old switch point, but hasn't created the new one yet. Note that
                 // the behavior of invalidating the old switch point before recompilation, and only creating the new one
-                // after recompilation is by design. If we didn't wait here, we would be busy looping through the
-                // fallback path of the invalidated switch point, relinking the call site again with the same
-                // invalidated switch point, invoking the fallback, etc. stealing CPU cycles from the recompilation
-                // task we're dependent on. This can still happen if the switch point gets invalidated after we grabbed
-                // it here, in which case we'll indeed do one busy relink immediately.
-                // On the other hand, in order to avoid a rare livelock, we aren't doing an infinite loop, and we
-                // aren't wait()-ing indefinitely. We'll do at most one, at most 1000ms long wait after which we'll
-                // return the current handle even if it's invalidated (and which'll then trigger one loop through the
-                // relink mechanism). We therefore strike a balance between busy looping and a livelock risk by making
-                // sure that there's at most one iteration of busy loop per second. It is theoretically possible to
-                // correctly implement this without ever risking a livelock, but using this heuristic we eliminate the
-                // chance of the livelock, while still maintaining a good enough busy-looping prevention.
+                // after recompilation is by design. If we didn't wait here for the recompilation to complete, we would
+                // be busy looping through the fallback path of the invalidated switch point, relinking the call site
+                // again with the same invalidated switch point, invoking the fallback, etc. stealing CPU cycles from
+                // the recompilation task we're dependent on. This can still happen if the switch point gets invalidated
+                // after we grabbed it here, in which case we'll indeed do one busy relink immediately.
                 try {
-                    wait(1000L);
+                    wait();
                 } catch (final InterruptedException e) {
                     // Intentionally ignored. There's nothing meaningful we can do if we're interrupted
                 }
@@ -631,7 +623,6 @@
                 return new HandleAndAssumptions(handle, assumptions);
             }
         }
-        throw new AssertionError(); // never reached
     }
 
     private static void relinkComposableInvoker(final CallSite cs, final CompiledFunction inv, final boolean constructor) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java	Thu Mar 19 16:13:54 2015 -0700
@@ -330,12 +330,15 @@
      * Indicate that proto itself has changed in hierarchy somewhere.
      */
     synchronized void invalidateAllProtoGetSwitchPoints() {
-        if (protoGetSwitches != null && !protoGetSwitches.isEmpty()) {
-            if (Context.DEBUG) {
-                protoInvalidations += protoGetSwitches.size();
+        if (protoGetSwitches != null) {
+            final int size = protoGetSwitches.size();
+            if (size > 0) {
+                if (Context.DEBUG) {
+                    protoInvalidations += size;
+                }
+                SwitchPoint.invalidateAll(protoGetSwitches.values().toArray(new SwitchPoint[size]));
+                protoGetSwitches.clear();
             }
-            SwitchPoint.invalidateAll(protoGetSwitches.values().toArray(new SwitchPoint[protoGetSwitches.values().size()]));
-            protoGetSwitches.clear();
         }
     }
 
@@ -375,7 +378,8 @@
         }
     }
 
-    // Update the free slots bitmap for a property that has been deleted and/or added.
+    // Update the free slots bitmap for a property that has been deleted and/or added. This method is not synchronized
+    // as it is always invoked on a newly created instance.
     private void updateFreeSlots(final Property oldProperty, final Property newProperty) {
         // Free slots bitset is possibly shared with parent map, so we must clone it before making modifications.
         boolean freeSlotsCloned = false;
@@ -425,7 +429,7 @@
      *
      * @return New {@link PropertyMap} with {@link Property} added.
      */
-    public PropertyMap addProperty(final Property property) {
+    public synchronized PropertyMap addProperty(final Property property) {
         if (listeners != null) {
             listeners.propertyAdded(property);
         }
@@ -434,9 +438,9 @@
         if (newMap == null) {
             final PropertyHashMap newProperties = properties.immutableAdd(property);
             newMap = new PropertyMap(this, newProperties);
-            addToHistory(property, newMap);
             newMap.updateFlagsAndBoundaries(property);
             newMap.updateFreeSlots(null, property);
+            addToHistory(property, newMap);
         }
 
         return newMap;
@@ -449,7 +453,7 @@
      *
      * @return New {@link PropertyMap} with {@link Property} removed or {@code null} if not found.
      */
-    public PropertyMap deleteProperty(final Property property) {
+    public synchronized PropertyMap deleteProperty(final Property property) {
         if (listeners != null) {
             listeners.propertyDeleted(property);
         }
@@ -881,8 +885,7 @@
      * @param newProto New prototype object to replace oldProto.
      * @return New {@link PropertyMap} with prototype changed.
      */
-    public PropertyMap changeProto(final ScriptObject newProto) {
-
+    public synchronized PropertyMap changeProto(final ScriptObject newProto) {
         final PropertyMap nextMap = checkProtoHistory(newProto);
         if (nextMap != null) {
             return nextMap;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8075090.js	Thu Mar 19 16:13:54 2015 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8075090: Add tests for the basic failure of try/finally compilation
+ *
+ * @test
+ * @run
+ */
+
+(function() {
+    var finallyExpected = false;
+    try {
+        for(var i = 0; i < 2; ++i) {
+            if(i == 1) {
+                continue;
+            }
+        }
+        finallyExpected = true;
+    } finally {
+        Assert.assertTrue(finallyExpected);
+    }
+})();
+
+(function() {
+    var finallyExpected = false;
+    try {
+        for(var i = 0; i < 2; ++i) {
+            if(i == 1) {
+                break;
+            }
+        }
+        finallyExpected = true;
+    } finally {
+        Assert.assertTrue(finallyExpected);
+    }
+})();
+
+(function() {
+    var finallyExpected = false;
+    try {
+        L1: {
+            if ((function(){return true})()) {
+                break L1;
+            }
+            Assert.fail(); // unreachable
+        }
+        finallyExpected = true;
+    } finally {
+        Assert.assertTrue(finallyExpected);
+    }
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8075207.js	Thu Mar 19 16:13:54 2015 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8075207: Nashorn parser API returns StatementTree objects in out of order
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var ExpressionStatementTree = Java.type("jdk.nashorn.api.tree.ExpressionStatementTree");
+var FunctionDeclarationTree = Java.type("jdk.nashorn.api.tree.FunctionDeclarationTree");
+var VariableTree = Java.type("jdk.nashorn.api.tree.VariableTree");
+
+var parser = Parser.create();
+
+var ast = parser.parse("hello.js", <<CODE
+
+var hello = 'hello';
+
+function print_hello() {
+    var x = 2;
+    print(hello);
+    function inner_func() {}
+    var y = function() {
+        var PI = Math.PI;
+        function inner2() {}
+        var E = Math.E;
+    }
+}
+
+var hello = "hello 2";
+
+CODE, print);
+
+var stats = ast.sourceElements;
+Assert.assertTrue(stats.get(0) instanceof VariableTree);
+Assert.assertTrue(stats.get(1) instanceof FunctionDeclarationTree);
+Assert.assertTrue(stats.get(2) instanceof VariableTree);
+
+var print_hello = stats.get(1);
+Assert.assertEquals(print_hello.name, "print_hello");
+var print_hello_stats = print_hello.body.statements;
+Assert.assertTrue(print_hello_stats.get(0) instanceof VariableTree);
+Assert.assertTrue(print_hello_stats.get(1) instanceof ExpressionStatementTree);
+Assert.assertTrue(print_hello_stats.get(2) instanceof FunctionDeclarationTree);
+Assert.assertTrue(print_hello_stats.get(3) instanceof VariableTree);
+
+var anonFunc = print_hello_stats.get(3).initializer;
+var anonFunc_stats = anonFunc.body.statements;
+Assert.assertTrue(anonFunc_stats.get(0) instanceof VariableTree);
+Assert.assertTrue(anonFunc_stats.get(1) instanceof FunctionDeclarationTree);
+Assert.assertTrue(anonFunc_stats.get(2) instanceof VariableTree);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8075448.js	Thu Mar 19 16:13:54 2015 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8075448: nashorn parser API returns init variable tree object of a for
+ * loop after for loop statement tree object 
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var ForLoopTree = Java.type("jdk.nashorn.api.tree.ForLoopTree");
+var VariableTree = Java.type("jdk.nashorn.api.tree.VariableTree");
+var parser = Parser.create();
+
+var code = <<EOF
+for (var i = 0; i < 10; i++)
+    print("hello");
+EOF;
+
+var ast = parser.parse("test.js", code, print);
+var stats = ast.sourceElements;
+
+Assert.assertTrue(stats[0] instanceof VariableTree);
+Assert.assertEquals(stats[0].name, "i");
+Assert.assertTrue(stats[1] instanceof ForLoopTree);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8075454.js	Thu Mar 19 16:13:54 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8075454: Anonymous functions have internal names exposed via parser API
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+var Parser = Java.type("jdk.nashorn.api.tree.Parser");
+var parser = Parser.create();
+
+var ast = parser.parse("test.js", <<EOF
+
+function(x) {
+  return x*x
+}
+
+EOF, print);
+
+Assert.assertNull(ast.sourceElements[0].name);
--- a/nashorn/test/script/basic/typedarrays.js	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/test/script/basic/typedarrays.js	Thu Mar 19 16:13:54 2015 -0700
@@ -28,6 +28,17 @@
  * @run
  */
 
+//JDK-8066217, constructor for arraybuffer not behaving as per spec
+function checkLength(ab, l) {
+    if (ab.byteLength != l) {
+        throw "length error: " + ab.byteLength + " != " + l;
+    }
+}
+checkLength(new ArrayBuffer(), 0);
+checkLength(new ArrayBuffer(0), 0);
+checkLength(new ArrayBuffer(1024), 1024);
+checkLength(new ArrayBuffer(1,2,3), 1);
+checkLength(new ArrayBuffer([17]), 17);
 
 var typeDefinitions = [
 Int8Array,
--- a/nashorn/test/script/nosecurity/parserapi.js.EXPECTED	Thu Mar 19 12:59:27 2015 -0700
+++ b/nashorn/test/script/nosecurity/parserapi.js.EXPECTED	Thu Mar 19 16:13:54 2015 -0700
@@ -1364,32 +1364,6 @@
       ]
     },
     {
-      "endPosition": "1380",
-      "kind": "FUNCTION",
-      "name": "test",
-      "body": {
-        "endPosition": "1377",
-        "kind": "BLOCK",
-        "statements": [
-          {
-            "expression": {
-              "endPosition": "1377",
-              "kind": "STRING_LITERAL",
-              "value": "use strict",
-              "startPosition": "1367"
-            },
-            "endPosition": "1377",
-            "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "1367"
-          }
-        ],
-        "startPosition": "1364"
-      },
-      "strict": "true",
-      "startPosition": "1348",
-      "parameters": []
-    },
-    {
       "endPosition": "1282",
       "kind": "VARIABLE",
       "name": "hello",
@@ -1495,6 +1469,32 @@
       "endPosition": "1347",
       "kind": "EXPRESSION_STATEMENT",
       "startPosition": "1333"
+    },
+    {
+      "endPosition": "1380",
+      "kind": "FUNCTION",
+      "name": "test",
+      "body": {
+        "endPosition": "1377",
+        "kind": "BLOCK",
+        "statements": [
+          {
+            "expression": {
+              "endPosition": "1377",
+              "kind": "STRING_LITERAL",
+              "value": "use strict",
+              "startPosition": "1367"
+            },
+            "endPosition": "1377",
+            "kind": "EXPRESSION_STATEMENT",
+            "startPosition": "1367"
+          }
+        ],
+        "startPosition": "1364"
+      },
+      "strict": "true",
+      "startPosition": "1348",
+      "parameters": []
     }
   ],
   "sourceName": "parsertests/functions.js",
@@ -3976,6 +3976,17 @@
   "kind": "COMPILATION_UNIT",
   "sourceElements": [
     {
+      "expression": {
+        "endPosition": "1133",
+        "kind": "STRING_LITERAL",
+        "value": "use strict",
+        "startPosition": "1123"
+      },
+      "endPosition": "1133",
+      "kind": "EXPRESSION_STATEMENT",
+      "startPosition": "1123"
+    },
+    {
       "endPosition": "1165",
       "kind": "FUNCTION",
       "name": "f",
@@ -4000,17 +4011,6 @@
       "strict": "true",
       "startPosition": "1136",
       "parameters": []
-    },
-    {
-      "expression": {
-        "endPosition": "1133",
-        "kind": "STRING_LITERAL",
-        "value": "use strict",
-        "startPosition": "1123"
-      },
-      "endPosition": "1133",
-      "kind": "EXPRESSION_STATEMENT",
-      "startPosition": "1123"
     }
   ],
   "sourceName": "parsertests/useStrict.js",
@@ -4919,808 +4919,6 @@
       "parameters": []
     },
     {
-      "endPosition": "3598",
-      "kind": "FUNCTION",
-      "name": "processFiles",
-      "body": {
-        "endPosition": "3555",
-        "kind": "BLOCK",
-        "statements": [
-          {
-            "endPosition": "2938",
-            "kind": "VARIABLE",
-            "name": "File",
-            "startPosition": "2906",
-            "initializer": {
-              "endPosition": "2938",
-              "kind": "FUNCTION_INVOCATION",
-              "functionSelect": {
-                "identifier": "type",
-                "expression": {
-                  "endPosition": "2917",
-                  "kind": "IDENTIFIER",
-                  "name": "Java",
-                  "startPosition": "2913"
-                },
-                "endPosition": "2922",
-                "kind": "MEMBER_SELECT",
-                "startPosition": "2913"
-              },
-              "arguments": [
-                {
-                  "endPosition": "2936",
-                  "kind": "STRING_LITERAL",
-                  "value": "java.io.File",
-                  "startPosition": "2924"
-                }
-              ],
-              "startPosition": "2913"
-            }
-          },
-          {
-            "endPosition": "2993",
-            "kind": "VARIABLE",
-            "name": "files",
-            "startPosition": "2947",
-            "initializer": {
-              "endPosition": "2993",
-              "kind": "FUNCTION_INVOCATION",
-              "functionSelect": {
-                "identifier": "listFiles",
-                "expression": {
-                  "constructorExpression": {
-                    "endPosition": "2981",
-                    "kind": "FUNCTION_INVOCATION",
-                    "functionSelect": {
-                      "endPosition": "2963",
-                      "kind": "IDENTIFIER",
-                      "name": "File",
-                      "startPosition": "2959"
-                    },
-                    "arguments": [
-                      {
-                        "leftOperand": {
-                          "endPosition": "2971",
-                          "kind": "IDENTIFIER",
-                          "name": "__DIR__",
-                          "startPosition": "2964"
-                        },
-                        "endPosition": "2980",
-                        "kind": "PLUS",
-                        "rightOperand": {
-                          "endPosition": "2980",
-                          "kind": "IDENTIFIER",
-                          "name": "subdir",
-                          "startPosition": "2974"
-                        },
-                        "startPosition": "2964"
-                      }
-                    ],
-                    "startPosition": "2959"
-                  },
-                  "endPosition": "2981",
-                  "kind": "NEW",
-                  "startPosition": "2955"
-                },
-                "endPosition": "2991",
-                "kind": "MEMBER_SELECT",
-                "startPosition": "2955"
-              },
-              "arguments": [],
-              "startPosition": "2955"
-            }
-          },
-          {
-            "expression": {
-              "endPosition": "3026",
-              "kind": "FUNCTION_INVOCATION",
-              "functionSelect": {
-                "identifier": "sort",
-                "expression": {
-                  "identifier": "Arrays",
-                  "expression": {
-                    "identifier": "util",
-                    "expression": {
-                      "endPosition": "3002",
-                      "kind": "IDENTIFIER",
-                      "name": "java",
-                      "startPosition": "2998"
-                    },
-                    "endPosition": "3007",
-                    "kind": "MEMBER_SELECT",
-                    "startPosition": "2998"
-                  },
-                  "endPosition": "3014",
-                  "kind": "MEMBER_SELECT",
-                  "startPosition": "2998"
-                },
-                "endPosition": "3019",
-                "kind": "MEMBER_SELECT",
-                "startPosition": "2998"
-              },
-              "arguments": [
-                {
-                  "endPosition": "3025",
-                  "kind": "IDENTIFIER",
-                  "name": "files",
-                  "startPosition": "3020"
-                }
-              ],
-              "startPosition": "2998"
-            },
-            "endPosition": "3026",
-            "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "2998"
-          },
-          {
-            "endPosition": "3049",
-            "kind": "VARIABLE",
-            "name": "file",
-            "startPosition": "3045"
-          },
-          {
-            "expression": {
-              "endPosition": "3058",
-              "kind": "IDENTIFIER",
-              "name": "files",
-              "startPosition": "3053"
-            },
-            "endPosition": "3555",
-            "kind": "FOR_IN_LOOP",
-            "forEach": "true",
-            "variable": {
-              "endPosition": "3049",
-              "kind": "IDENTIFIER",
-              "name": "file",
-              "startPosition": "3045"
-            },
-            "statement": {
-              "endPosition": "3555",
-              "kind": "BLOCK",
-              "statements": [
-                {
-                  "condition": {
-                    "endPosition": "3098",
-                    "kind": "FUNCTION_INVOCATION",
-                    "functionSelect": {
-                      "identifier": "endsWith",
-                      "expression": {
-                        "identifier": "name",
-                        "expression": {
-                          "endPosition": "3077",
-                          "kind": "IDENTIFIER",
-                          "name": "file",
-                          "startPosition": "3073"
-                        },
-                        "endPosition": "3082",
-                        "kind": "MEMBER_SELECT",
-                        "startPosition": "3073"
-                      },
-                      "endPosition": "3091",
-                      "kind": "MEMBER_SELECT",
-                      "startPosition": "3073"
-                    },
-                    "arguments": [
-                      {
-                        "endPosition": "3096",
-                        "kind": "STRING_LITERAL",
-                        "value": ".js",
-                        "startPosition": "3093"
-                      }
-                    ],
-                    "startPosition": "3073"
-                  },
-                  "endPosition": "3550",
-                  "kind": "IF",
-                  "startPosition": "3069",
-                  "thenStatement": {
-                    "endPosition": "3550",
-                    "kind": "BLOCK",
-                    "statements": [
-                      {
-                        "endPosition": "3141",
-                        "kind": "VARIABLE",
-                        "name": "script",
-                        "startPosition": "3117",
-                        "initializer": {
-                          "endPosition": "3141",
-                          "kind": "FUNCTION_INVOCATION",
-                          "functionSelect": {
-                            "endPosition": "3135",
-                            "kind": "IDENTIFIER",
-                            "name": "readFully",
-                            "startPosition": "3126"
-                          },
-                          "arguments": [
-                            {
-                              "endPosition": "3140",
-                              "kind": "IDENTIFIER",
-                              "name": "file",
-                              "startPosition": "3136"
-                            }
-                          ],
-                          "startPosition": "3126"
-                        }
-                      },
-                      {
-                        "endPosition": "3179",
-                        "kind": "VARIABLE",
-                        "name": "parser",
-                        "startPosition": "3158",
-                        "initializer": {
-                          "constructorExpression": {
-                            "endPosition": "3179",
-                            "kind": "FUNCTION_INVOCATION",
-                            "functionSelect": {
-                              "endPosition": "3177",
-                              "kind": "IDENTIFIER",
-                              "name": "Parser",
-                              "startPosition": "3171"
-                            },
-                            "arguments": [],
-                            "startPosition": "3171"
-                          },
-                          "endPosition": "3179",
-                          "kind": "NEW",
-                          "startPosition": "3167"
-                        }
-                      },
-                      {
-                        "endPosition": "3415",
-                        "kind": "VARIABLE",
-                        "name": "tree",
-                        "startPosition": "3196",
-                        "initializer": {
-                          "endPosition": "3415",
-                          "kind": "FUNCTION_INVOCATION",
-                          "functionSelect": {
-                            "identifier": "parse",
-                            "expression": {
-                              "endPosition": "3209",
-                              "kind": "IDENTIFIER",
-                              "name": "parser",
-                              "startPosition": "3203"
-                            },
-                            "endPosition": "3215",
-                            "kind": "MEMBER_SELECT",
-                            "startPosition": "3203"
-                          },
-                          "arguments": [
-                            {
-                              "leftOperand": {
-                                "leftOperand": {
-                                  "endPosition": "3222",
-                                  "kind": "IDENTIFIER",
-                                  "name": "subdir",
-                                  "startPosition": "3216"
-                                },
-                                "endPosition": "3227",
-                                "kind": "PLUS",
-                                "rightOperand": {
-                                  "endPosition": "3227",
-                                  "kind": "STRING_LITERAL",
-                                  "value": "/",
-                                  "startPosition": "3226"
-                                },
-                                "startPosition": "3216"
-                              },
-                              "endPosition": "3240",
-                              "kind": "PLUS",
-                              "rightOperand": {
-                                "identifier": "name",
-                                "expression": {
-                                  "endPosition": "3235",
-                                  "kind": "IDENTIFIER",
-                                  "name": "file",
-                                  "startPosition": "3231"
-                                },
-                                "endPosition": "3240",
-                                "kind": "MEMBER_SELECT",
-                                "startPosition": "3231"
-                              },
-                              "startPosition": "3216"
-                            },
-                            {
-                              "endPosition": "3248",
-                              "kind": "IDENTIFIER",
-                              "name": "script",
-                              "startPosition": "3242"
-                            },
-                            {
-                              "endPosition": "3286",
-                              "kind": "FUNCTION_EXPRESSION",
-                              "body": {
-                                "endPosition": "3397",
-                                "kind": "BLOCK",
-                                "statements": [
-                                  {
-                                    "expression": {
-                                      "endPosition": "3365",
-                                      "kind": "FUNCTION_INVOCATION",
-                                      "functionSelect": {
-                                        "endPosition": "3312",
-                                        "kind": "IDENTIFIER",
-                                        "name": "print",
-                                        "startPosition": "3307"
-                                      },
-                                      "arguments": [
-                                        {
-                                          "endPosition": "3364",
-                                          "kind": "FUNCTION_INVOCATION",
-                                          "functionSelect": {
-                                            "identifier": "stringify",
-                                            "expression": {
-                                              "endPosition": "3317",
-                                              "kind": "IDENTIFIER",
-                                              "name": "JSON",
-                                              "startPosition": "3313"
-                                            },
-                                            "endPosition": "3327",
-                                            "kind": "MEMBER_SELECT",
-                                            "startPosition": "3313"
-                                          },
-                                          "arguments": [
-                                            {
-                                              "endPosition": "3354",
-                                              "kind": "FUNCTION_INVOCATION",
-                                              "functionSelect": {
-                                                "identifier": "convert",
-                                                "expression": {
-                                                  "endPosition": "3334",
-                                                  "kind": "IDENTIFIER",
-                                                  "name": "parser",
-                                                  "startPosition": "3328"
-                                                },
-                                                "endPosition": "3342",
-                                                "kind": "MEMBER_SELECT",
-                                                "startPosition": "3328"
-                                              },
-                                              "arguments": [
-                                                {
-                                                  "endPosition": "3353",
-                                                  "kind": "IDENTIFIER",
-                                                  "name": "diagnostic",
-                                                  "startPosition": "3343"
-                                                }
-                                              ],
-                                              "startPosition": "3328"
-                                            },
-                                            {
-                                              "endPosition": "3360",
-                                              "kind": "NULL_LITERAL",
-                                              "startPosition": "3356"
-                                            },
-                                            {
-                                              "endPosition": "3363",
-                                              "kind": "NUMBER_LITERAL",
-                                              "value": "2",
-                                              "startPosition": "3362"
-                                            }
-                                          ],
-                                          "startPosition": "3313"
-                                        }
-                                      ],
-                                      "startPosition": "3307"
-                                    },
-                                    "endPosition": "3365",
-                                    "kind": "EXPRESSION_STATEMENT",
-                                    "startPosition": "3307"
-                                  },
-                                  {
-                                    "expression": {
-                                      "endPosition": "3396",
-                                      "kind": "FUNCTION_INVOCATION",
-                                      "functionSelect": {
-                                        "endPosition": "3391",
-                                        "kind": "IDENTIFIER",
-                                        "name": "print",
-                                        "startPosition": "3386"
-                                      },
-                                      "arguments": [
-                                        {
-                                          "endPosition": "3394",
-                                          "kind": "STRING_LITERAL",
-                                          "value": ",",
-                                          "startPosition": "3393"
-                                        }
-                                      ],
-                                      "startPosition": "3386"
-                                    },
-                                    "endPosition": "3396",
-                                    "kind": "EXPRESSION_STATEMENT",
-                                    "startPosition": "3386"
-                                  }
-                                ],
-                                "startPosition": "3286"
-                              },
-                              "strict": "false",
-                              "startPosition": "3286",
-                              "parameters": [
-                                {
-                                  "endPosition": "3284",
-                                  "kind": "IDENTIFIER",
-                                  "name": "diagnostic",
-                                  "startPosition": "3274"
-                                }
-                              ]
-                            }
-                          ],
-                          "startPosition": "3203"
-                        }
-                      },
-                      {
-                        "condition": {
-                          "leftOperand": {
-                            "endPosition": "3437",
-                            "kind": "IDENTIFIER",
-                            "name": "tree",
-                            "startPosition": "3433"
-                          },
-                          "endPosition": "3445",
-                          "kind": "NOT_EQUAL_TO",
-                          "rightOperand": {
-                            "endPosition": "3445",
-                            "kind": "NULL_LITERAL",
-                            "startPosition": "3441"
-                          },
-                          "startPosition": "3433"
-                        },
-                        "endPosition": "3541",
-                        "kind": "IF",
-                        "startPosition": "3429",
-                        "thenStatement": {
-                          "endPosition": "3541",
-                          "kind": "BLOCK",
-                          "statements": [
-                            {
-                              "expression": {
-                                "endPosition": "3500",
-                                "kind": "FUNCTION_INVOCATION",
-                                "functionSelect": {
-                                  "endPosition": "3469",
-                                  "kind": "IDENTIFIER",
-                                  "name": "print",
-                                  "startPosition": "3464"
-                                },
-                                "arguments": [
-                                  {
-                                    "endPosition": "3499",
-                                    "kind": "FUNCTION_INVOCATION",
-                                    "functionSelect": {
-                                      "identifier": "stringify",
-                                      "expression": {
-                                        "endPosition": "3474",
-                                        "kind": "IDENTIFIER",
-                                        "name": "JSON",
-                                        "startPosition": "3470"
-                                      },
-                                      "endPosition": "3484",
-                                      "kind": "MEMBER_SELECT",
-                                      "startPosition": "3470"
-                                    },
-                                    "arguments": [
-                                      {
-                                        "endPosition": "3489",
-                                        "kind": "IDENTIFIER",
-                                        "name": "tree",
-                                        "startPosition": "3485"
-                                      },
-                                      {
-                                        "endPosition": "3495",
-                                        "kind": "NULL_LITERAL",
-                                        "startPosition": "3491"
-                                      },
-                                      {
-                                        "endPosition": "3498",
-                                        "kind": "NUMBER_LITERAL",
-                                        "value": "2",
-                                        "startPosition": "3497"
-                                      }
-                                    ],
-                                    "startPosition": "3470"
-                                  }
-                                ],
-                                "startPosition": "3464"
-                              },
-                              "endPosition": "3500",
-                              "kind": "EXPRESSION_STATEMENT",
-                              "startPosition": "3464"
-                            },
-                            {
-                              "expression": {
-                                "endPosition": "3527",
-                                "kind": "FUNCTION_INVOCATION",
-                                "functionSelect": {
-                                  "endPosition": "3522",
-                                  "kind": "IDENTIFIER",
-                                  "name": "print",
-                                  "startPosition": "3517"
-                                },
-                                "arguments": [
-                                  {
-                                    "endPosition": "3525",
-                                    "kind": "STRING_LITERAL",
-                                    "value": ",",
-                                    "startPosition": "3524"
-                                  }
-                                ],
-                                "startPosition": "3517"
-                              },
-                              "endPosition": "3527",
-                              "kind": "EXPRESSION_STATEMENT",
-                              "startPosition": "3517"
-                            }
-                          ],
-                          "startPosition": "3447"
-                        }
-                      }
-                    ],
-                    "startPosition": "3100"
-                  }
-                }
-              ],
-              "startPosition": "3060"
-            },
-            "startPosition": "3031"
-          }
-        ],
-        "startPosition": "2897"
-      },
-      "strict": "false",
-      "startPosition": "2867",
-      "parameters": [
-        {
-          "endPosition": "2895",
-          "kind": "IDENTIFIER",
-          "name": "subdir",
-          "startPosition": "2889"
-        }
-      ]
-    },
-    {
-      "endPosition": "3901",
-      "kind": "FUNCTION",
-      "name": "main",
-      "body": {
-        "endPosition": "3899",
-        "kind": "BLOCK",
-        "statements": [
-          {
-            "expression": {
-              "endPosition": "3631",
-              "kind": "FUNCTION_INVOCATION",
-              "functionSelect": {
-                "endPosition": "3626",
-                "kind": "IDENTIFIER",
-                "name": "print",
-                "startPosition": "3621"
-              },
-              "arguments": [
-                {
-                  "endPosition": "3629",
-                  "kind": "STRING_LITERAL",
-                  "value": "[",
-                  "startPosition": "3628"
-                }
-              ],
-              "startPosition": "3621"
-            },
-            "endPosition": "3631",
-            "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "3621"
-          },
-          {
-            "expression": {
-              "endPosition": "3665",
-              "kind": "FUNCTION_INVOCATION",
-              "functionSelect": {
-                "endPosition": "3650",
-                "kind": "IDENTIFIER",
-                "name": "processFiles",
-                "startPosition": "3638"
-              },
-              "arguments": [
-                {
-                  "endPosition": "3663",
-                  "kind": "STRING_LITERAL",
-                  "value": "parsertests",
-                  "startPosition": "3652"
-                }
-              ],
-              "startPosition": "3638"
-            },
-            "endPosition": "3665",
-            "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "3638"
-          },
-          {
-            "expression": {
-              "endPosition": "3706",
-              "kind": "FUNCTION_INVOCATION",
-              "functionSelect": {
-                "endPosition": "3683",
-                "kind": "IDENTIFIER",
-                "name": "processFiles",
-                "startPosition": "3671"
-              },
-              "arguments": [
-                {
-                  "endPosition": "3704",
-                  "kind": "STRING_LITERAL",
-                  "value": "parsernegativetests",
-                  "startPosition": "3685"
-                }
-              ],
-              "startPosition": "3671"
-            },
-            "endPosition": "3706",
-            "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "3671"
-          },
-          {
-            "endPosition": "3775",
-            "kind": "VARIABLE",
-            "name": "script",
-            "startPosition": "3747",
-            "initializer": {
-              "endPosition": "3775",
-              "kind": "FUNCTION_INVOCATION",
-              "functionSelect": {
-                "endPosition": "3765",
-                "kind": "IDENTIFIER",
-                "name": "readFully",
-                "startPosition": "3756"
-              },
-              "arguments": [
-                {
-                  "endPosition": "3774",
-                  "kind": "IDENTIFIER",
-                  "name": "__FILE__",
-                  "startPosition": "3766"
-                }
-              ],
-              "startPosition": "3756"
-            }
-          },
-          {
-            "endPosition": "3840",
-            "kind": "VARIABLE",
-            "name": "tree",
-            "startPosition": "3785",
-            "initializer": {
-              "endPosition": "3840",
-              "kind": "FUNCTION_INVOCATION",
-              "functionSelect": {
-                "identifier": "parse",
-                "expression": {
-                  "constructorExpression": {
-                    "endPosition": "3804",
-                    "kind": "FUNCTION_INVOCATION",
-                    "functionSelect": {
-                      "endPosition": "3802",
-                      "kind": "IDENTIFIER",
-                      "name": "Parser",
-                      "startPosition": "3796"
-                    },
-                    "arguments": [],
-                    "startPosition": "3796"
-                  },
-                  "endPosition": "3804",
-                  "kind": "NEW",
-                  "startPosition": "3792"
-                },
-                "endPosition": "3810",
-                "kind": "MEMBER_SELECT",
-                "startPosition": "3792"
-              },
-              "arguments": [
-                {
-                  "endPosition": "3824",
-                  "kind": "STRING_LITERAL",
-                  "value": "parserapi.js",
-                  "startPosition": "3812"
-                },
-                {
-                  "endPosition": "3833",
-                  "kind": "IDENTIFIER",
-                  "name": "script",
-                  "startPosition": "3827"
-                },
-                {
-                  "endPosition": "3839",
-                  "kind": "NULL_LITERAL",
-                  "startPosition": "3835"
-                }
-              ],
-              "startPosition": "3792"
-            }
-          },
-          {
-            "expression": {
-              "endPosition": "3882",
-              "kind": "FUNCTION_INVOCATION",
-              "functionSelect": {
-                "endPosition": "3851",
-                "kind": "IDENTIFIER",
-                "name": "print",
-                "startPosition": "3846"
-              },
-              "arguments": [
-                {
-                  "endPosition": "3881",
-                  "kind": "FUNCTION_INVOCATION",
-                  "functionSelect": {
-                    "identifier": "stringify",
-                    "expression": {
-                      "endPosition": "3856",
-                      "kind": "IDENTIFIER",
-                      "name": "JSON",
-                      "startPosition": "3852"
-                    },
-                    "endPosition": "3866",
-                    "kind": "MEMBER_SELECT",
-                    "startPosition": "3852"
-                  },
-                  "arguments": [
-                    {
-                      "endPosition": "3871",
-                      "kind": "IDENTIFIER",
-                      "name": "tree",
-                      "startPosition": "3867"
-                    },
-                    {
-                      "endPosition": "3877",
-                      "kind": "NULL_LITERAL",
-                      "startPosition": "3873"
-                    },
-                    {
-                      "endPosition": "3880",
-                      "kind": "NUMBER_LITERAL",
-                      "value": "2",
-                      "startPosition": "3879"
-                    }
-                  ],
-                  "startPosition": "3852"
-                }
-              ],
-              "startPosition": "3846"
-            },
-            "endPosition": "3882",
-            "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "3846"
-          },
-          {
-            "expression": {
-              "endPosition": "3898",
-              "kind": "FUNCTION_INVOCATION",
-              "functionSelect": {
-                "endPosition": "3893",
-                "kind": "IDENTIFIER",
-                "name": "print",
-                "startPosition": "3888"
-              },
-              "arguments": [
-                {
-                  "endPosition": "3896",
-                  "kind": "STRING_LITERAL",
-                  "value": "]",
-                  "startPosition": "3895"
-                }
-              ],
-              "startPosition": "3888"
-            },
-            "endPosition": "3898",
-            "kind": "EXPRESSION_STATEMENT",
-            "startPosition": "3888"
-          }
-        ],
-        "startPosition": "3615"
-      },
-      "strict": "false",
-      "startPosition": "3599",
-      "parameters": []
-    },
-    {
       "expression": {
         "expression": {
           "endPosition": "1305",
@@ -6991,6 +6189,808 @@
       "startPosition": "1972"
     },
     {
+      "endPosition": "3598",
+      "kind": "FUNCTION",
+      "name": "processFiles",
+      "body": {
+        "endPosition": "3555",
+        "kind": "BLOCK",
+        "statements": [
+          {
+            "endPosition": "2938",
+            "kind": "VARIABLE",
+            "name": "File",
+            "startPosition": "2906",
+            "initializer": {
+              "endPosition": "2938",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "identifier": "type",
+                "expression": {
+                  "endPosition": "2917",
+                  "kind": "IDENTIFIER",
+                  "name": "Java",
+                  "startPosition": "2913"
+                },
+                "endPosition": "2922",
+                "kind": "MEMBER_SELECT",
+                "startPosition": "2913"
+              },
+              "arguments": [
+                {
+                  "endPosition": "2936",
+                  "kind": "STRING_LITERAL",
+                  "value": "java.io.File",
+                  "startPosition": "2924"
+                }
+              ],
+              "startPosition": "2913"
+            }
+          },
+          {
+            "endPosition": "2993",
+            "kind": "VARIABLE",
+            "name": "files",
+            "startPosition": "2947",
+            "initializer": {
+              "endPosition": "2993",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "identifier": "listFiles",
+                "expression": {
+                  "constructorExpression": {
+                    "endPosition": "2981",
+                    "kind": "FUNCTION_INVOCATION",
+                    "functionSelect": {
+                      "endPosition": "2963",
+                      "kind": "IDENTIFIER",
+                      "name": "File",
+                      "startPosition": "2959"
+                    },
+                    "arguments": [
+                      {
+                        "leftOperand": {
+                          "endPosition": "2971",
+                          "kind": "IDENTIFIER",
+                          "name": "__DIR__",
+                          "startPosition": "2964"
+                        },
+                        "endPosition": "2980",
+                        "kind": "PLUS",
+                        "rightOperand": {
+                          "endPosition": "2980",
+                          "kind": "IDENTIFIER",
+                          "name": "subdir",
+                          "startPosition": "2974"
+                        },
+                        "startPosition": "2964"
+                      }
+                    ],
+                    "startPosition": "2959"
+                  },
+                  "endPosition": "2981",
+                  "kind": "NEW",
+                  "startPosition": "2955"
+                },
+                "endPosition": "2991",
+                "kind": "MEMBER_SELECT",
+                "startPosition": "2955"
+              },
+              "arguments": [],
+              "startPosition": "2955"
+            }
+          },
+          {
+            "expression": {
+              "endPosition": "3026",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "identifier": "sort",
+                "expression": {
+                  "identifier": "Arrays",
+                  "expression": {
+                    "identifier": "util",
+                    "expression": {
+                      "endPosition": "3002",
+                      "kind": "IDENTIFIER",
+                      "name": "java",
+                      "startPosition": "2998"
+                    },
+                    "endPosition": "3007",
+                    "kind": "MEMBER_SELECT",
+                    "startPosition": "2998"
+                  },
+                  "endPosition": "3014",
+                  "kind": "MEMBER_SELECT",
+                  "startPosition": "2998"
+                },
+                "endPosition": "3019",
+                "kind": "MEMBER_SELECT",
+                "startPosition": "2998"
+              },
+              "arguments": [
+                {
+                  "endPosition": "3025",
+                  "kind": "IDENTIFIER",
+                  "name": "files",
+                  "startPosition": "3020"
+                }
+              ],
+              "startPosition": "2998"
+            },
+            "endPosition": "3026",
+            "kind": "EXPRESSION_STATEMENT",
+            "startPosition": "2998"
+          },
+          {
+            "endPosition": "3049",
+            "kind": "VARIABLE",
+            "name": "file",
+            "startPosition": "3045"
+          },
+          {
+            "expression": {
+              "endPosition": "3058",
+              "kind": "IDENTIFIER",
+              "name": "files",
+              "startPosition": "3053"
+            },
+            "endPosition": "3555",
+            "kind": "FOR_IN_LOOP",
+            "forEach": "true",
+            "variable": {
+              "endPosition": "3049",
+              "kind": "IDENTIFIER",
+              "name": "file",
+              "startPosition": "3045"
+            },
+            "statement": {
+              "endPosition": "3555",
+              "kind": "BLOCK",
+              "statements": [
+                {
+                  "condition": {
+                    "endPosition": "3098",
+                    "kind": "FUNCTION_INVOCATION",
+                    "functionSelect": {
+                      "identifier": "endsWith",
+                      "expression": {
+                        "identifier": "name",
+                        "expression": {
+                          "endPosition": "3077",
+                          "kind": "IDENTIFIER",
+                          "name": "file",
+                          "startPosition": "3073"
+                        },
+                        "endPosition": "3082",
+                        "kind": "MEMBER_SELECT",
+                        "startPosition": "3073"
+                      },
+                      "endPosition": "3091",
+                      "kind": "MEMBER_SELECT",
+                      "startPosition": "3073"
+                    },
+                    "arguments": [
+                      {
+                        "endPosition": "3096",
+                        "kind": "STRING_LITERAL",
+                        "value": ".js",
+                        "startPosition": "3093"
+                      }
+                    ],
+                    "startPosition": "3073"
+                  },
+                  "endPosition": "3550",
+                  "kind": "IF",
+                  "startPosition": "3069",
+                  "thenStatement": {
+                    "endPosition": "3550",
+                    "kind": "BLOCK",
+                    "statements": [
+                      {
+                        "endPosition": "3141",
+                        "kind": "VARIABLE",
+                        "name": "script",
+                        "startPosition": "3117",
+                        "initializer": {
+                          "endPosition": "3141",
+                          "kind": "FUNCTION_INVOCATION",
+                          "functionSelect": {
+                            "endPosition": "3135",
+                            "kind": "IDENTIFIER",
+                            "name": "readFully",
+                            "startPosition": "3126"
+                          },
+                          "arguments": [
+                            {
+                              "endPosition": "3140",
+                              "kind": "IDENTIFIER",
+                              "name": "file",
+                              "startPosition": "3136"
+                            }
+                          ],
+                          "startPosition": "3126"
+                        }
+                      },
+                      {
+                        "endPosition": "3179",
+                        "kind": "VARIABLE",
+                        "name": "parser",
+                        "startPosition": "3158",
+                        "initializer": {
+                          "constructorExpression": {
+                            "endPosition": "3179",
+                            "kind": "FUNCTION_INVOCATION",
+                            "functionSelect": {
+                              "endPosition": "3177",
+                              "kind": "IDENTIFIER",
+                              "name": "Parser",
+                              "startPosition": "3171"
+                            },
+                            "arguments": [],
+                            "startPosition": "3171"
+                          },
+                          "endPosition": "3179",
+                          "kind": "NEW",
+                          "startPosition": "3167"
+                        }
+                      },
+                      {
+                        "endPosition": "3415",
+                        "kind": "VARIABLE",
+                        "name": "tree",
+                        "startPosition": "3196",
+                        "initializer": {
+                          "endPosition": "3415",
+                          "kind": "FUNCTION_INVOCATION",
+                          "functionSelect": {
+                            "identifier": "parse",
+                            "expression": {
+                              "endPosition": "3209",
+                              "kind": "IDENTIFIER",
+                              "name": "parser",
+                              "startPosition": "3203"
+                            },
+                            "endPosition": "3215",
+                            "kind": "MEMBER_SELECT",
+                            "startPosition": "3203"
+                          },
+                          "arguments": [
+                            {
+                              "leftOperand": {
+                                "leftOperand": {
+                                  "endPosition": "3222",
+                                  "kind": "IDENTIFIER",
+                                  "name": "subdir",
+                                  "startPosition": "3216"
+                                },
+                                "endPosition": "3227",
+                                "kind": "PLUS",
+                                "rightOperand": {
+                                  "endPosition": "3227",
+                                  "kind": "STRING_LITERAL",
+                                  "value": "/",
+                                  "startPosition": "3226"
+                                },
+                                "startPosition": "3216"
+                              },
+                              "endPosition": "3240",
+                              "kind": "PLUS",
+                              "rightOperand": {
+                                "identifier": "name",
+                                "expression": {
+                                  "endPosition": "3235",
+                                  "kind": "IDENTIFIER",
+                                  "name": "file",
+                                  "startPosition": "3231"
+                                },
+                                "endPosition": "3240",
+                                "kind": "MEMBER_SELECT",
+                                "startPosition": "3231"
+                              },
+                              "startPosition": "3216"
+                            },
+                            {
+                              "endPosition": "3248",
+                              "kind": "IDENTIFIER",
+                              "name": "script",
+                              "startPosition": "3242"
+                            },
+                            {
+                              "endPosition": "3286",
+                              "kind": "FUNCTION_EXPRESSION",
+                              "body": {
+                                "endPosition": "3397",
+                                "kind": "BLOCK",
+                                "statements": [
+                                  {
+                                    "expression": {
+                                      "endPosition": "3365",
+                                      "kind": "FUNCTION_INVOCATION",
+                                      "functionSelect": {
+                                        "endPosition": "3312",
+                                        "kind": "IDENTIFIER",
+                                        "name": "print",
+                                        "startPosition": "3307"
+                                      },
+                                      "arguments": [
+                                        {
+                                          "endPosition": "3364",
+                                          "kind": "FUNCTION_INVOCATION",
+                                          "functionSelect": {
+                                            "identifier": "stringify",
+                                            "expression": {
+                                              "endPosition": "3317",
+                                              "kind": "IDENTIFIER",
+                                              "name": "JSON",
+                                              "startPosition": "3313"
+                                            },
+                                            "endPosition": "3327",
+                                            "kind": "MEMBER_SELECT",
+                                            "startPosition": "3313"
+                                          },
+                                          "arguments": [
+                                            {
+                                              "endPosition": "3354",
+                                              "kind": "FUNCTION_INVOCATION",
+                                              "functionSelect": {
+                                                "identifier": "convert",
+                                                "expression": {
+                                                  "endPosition": "3334",
+                                                  "kind": "IDENTIFIER",
+                                                  "name": "parser",
+                                                  "startPosition": "3328"
+                                                },
+                                                "endPosition": "3342",
+                                                "kind": "MEMBER_SELECT",
+                                                "startPosition": "3328"
+                                              },
+                                              "arguments": [
+                                                {
+                                                  "endPosition": "3353",
+                                                  "kind": "IDENTIFIER",
+                                                  "name": "diagnostic",
+                                                  "startPosition": "3343"
+                                                }
+                                              ],
+                                              "startPosition": "3328"
+                                            },
+                                            {
+                                              "endPosition": "3360",
+                                              "kind": "NULL_LITERAL",
+                                              "startPosition": "3356"
+                                            },
+                                            {
+                                              "endPosition": "3363",
+                                              "kind": "NUMBER_LITERAL",
+                                              "value": "2",
+                                              "startPosition": "3362"
+                                            }
+                                          ],
+                                          "startPosition": "3313"
+                                        }
+                                      ],
+                                      "startPosition": "3307"
+                                    },
+                                    "endPosition": "3365",
+                                    "kind": "EXPRESSION_STATEMENT",
+                                    "startPosition": "3307"
+                                  },
+                                  {
+                                    "expression": {
+                                      "endPosition": "3396",
+                                      "kind": "FUNCTION_INVOCATION",
+                                      "functionSelect": {
+                                        "endPosition": "3391",
+                                        "kind": "IDENTIFIER",
+                                        "name": "print",
+                                        "startPosition": "3386"
+                                      },
+                                      "arguments": [
+                                        {
+                                          "endPosition": "3394",
+                                          "kind": "STRING_LITERAL",
+                                          "value": ",",
+                                          "startPosition": "3393"
+                                        }
+                                      ],
+                                      "startPosition": "3386"
+                                    },
+                                    "endPosition": "3396",
+                                    "kind": "EXPRESSION_STATEMENT",
+                                    "startPosition": "3386"
+                                  }
+                                ],
+                                "startPosition": "3286"
+                              },
+                              "strict": "false",
+                              "startPosition": "3286",
+                              "parameters": [
+                                {
+                                  "endPosition": "3284",
+                                  "kind": "IDENTIFIER",
+                                  "name": "diagnostic",
+                                  "startPosition": "3274"
+                                }
+                              ]
+                            }
+                          ],
+                          "startPosition": "3203"
+                        }
+                      },
+                      {
+                        "condition": {
+                          "leftOperand": {
+                            "endPosition": "3437",
+                            "kind": "IDENTIFIER",
+                            "name": "tree",
+                            "startPosition": "3433"
+                          },
+                          "endPosition": "3445",
+                          "kind": "NOT_EQUAL_TO",
+                          "rightOperand": {
+                            "endPosition": "3445",
+                            "kind": "NULL_LITERAL",
+                            "startPosition": "3441"
+                          },
+                          "startPosition": "3433"
+                        },
+                        "endPosition": "3541",
+                        "kind": "IF",
+                        "startPosition": "3429",
+                        "thenStatement": {
+                          "endPosition": "3541",
+                          "kind": "BLOCK",
+                          "statements": [
+                            {
+                              "expression": {
+                                "endPosition": "3500",
+                                "kind": "FUNCTION_INVOCATION",
+                                "functionSelect": {
+                                  "endPosition": "3469",
+                                  "kind": "IDENTIFIER",
+                                  "name": "print",
+                                  "startPosition": "3464"
+                                },
+                                "arguments": [
+                                  {
+                                    "endPosition": "3499",
+                                    "kind": "FUNCTION_INVOCATION",
+                                    "functionSelect": {
+                                      "identifier": "stringify",
+                                      "expression": {
+                                        "endPosition": "3474",
+                                        "kind": "IDENTIFIER",
+                                        "name": "JSON",
+                                        "startPosition": "3470"
+                                      },
+                                      "endPosition": "3484",
+                                      "kind": "MEMBER_SELECT",
+                                      "startPosition": "3470"
+                                    },
+                                    "arguments": [
+                                      {
+                                        "endPosition": "3489",
+                                        "kind": "IDENTIFIER",
+                                        "name": "tree",
+                                        "startPosition": "3485"
+                                      },
+                                      {
+                                        "endPosition": "3495",
+                                        "kind": "NULL_LITERAL",
+                                        "startPosition": "3491"
+                                      },
+                                      {
+                                        "endPosition": "3498",
+                                        "kind": "NUMBER_LITERAL",
+                                        "value": "2",
+                                        "startPosition": "3497"
+                                      }
+                                    ],
+                                    "startPosition": "3470"
+                                  }
+                                ],
+                                "startPosition": "3464"
+                              },
+                              "endPosition": "3500",
+                              "kind": "EXPRESSION_STATEMENT",
+                              "startPosition": "3464"
+                            },
+                            {
+                              "expression": {
+                                "endPosition": "3527",
+                                "kind": "FUNCTION_INVOCATION",
+                                "functionSelect": {
+                                  "endPosition": "3522",
+                                  "kind": "IDENTIFIER",
+                                  "name": "print",
+                                  "startPosition": "3517"
+                                },
+                                "arguments": [
+                                  {
+                                    "endPosition": "3525",
+                                    "kind": "STRING_LITERAL",
+                                    "value": ",",
+                                    "startPosition": "3524"
+                                  }
+                                ],
+                                "startPosition": "3517"
+                              },
+                              "endPosition": "3527",
+                              "kind": "EXPRESSION_STATEMENT",
+                              "startPosition": "3517"
+                            }
+                          ],
+                          "startPosition": "3447"
+                        }
+                      }
+                    ],
+                    "startPosition": "3100"
+                  }
+                }
+              ],
+              "startPosition": "3060"
+            },
+            "startPosition": "3031"
+          }
+        ],
+        "startPosition": "2897"
+      },
+      "strict": "false",
+      "startPosition": "2867",
+      "parameters": [
+        {
+          "endPosition": "2895",
+          "kind": "IDENTIFIER",
+          "name": "subdir",
+          "startPosition": "2889"
+        }
+      ]
+    },
+    {
+      "endPosition": "3901",
+      "kind": "FUNCTION",
+      "name": "main",
+      "body": {
+        "endPosition": "3899",
+        "kind": "BLOCK",
+        "statements": [
+          {
+            "expression": {
+              "endPosition": "3631",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "endPosition": "3626",
+                "kind": "IDENTIFIER",
+                "name": "print",
+                "startPosition": "3621"
+              },
+              "arguments": [
+                {
+                  "endPosition": "3629",
+                  "kind": "STRING_LITERAL",
+                  "value": "[",
+                  "startPosition": "3628"
+                }
+              ],
+              "startPosition": "3621"
+            },
+            "endPosition": "3631",
+            "kind": "EXPRESSION_STATEMENT",
+            "startPosition": "3621"
+          },
+          {
+            "expression": {
+              "endPosition": "3665",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "endPosition": "3650",
+                "kind": "IDENTIFIER",
+                "name": "processFiles",
+                "startPosition": "3638"
+              },
+              "arguments": [
+                {
+                  "endPosition": "3663",
+                  "kind": "STRING_LITERAL",
+                  "value": "parsertests",
+                  "startPosition": "3652"
+                }
+              ],
+              "startPosition": "3638"
+            },
+            "endPosition": "3665",
+            "kind": "EXPRESSION_STATEMENT",
+            "startPosition": "3638"
+          },
+          {
+            "expression": {
+              "endPosition": "3706",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "endPosition": "3683",
+                "kind": "IDENTIFIER",
+                "name": "processFiles",
+                "startPosition": "3671"
+              },
+              "arguments": [
+                {
+                  "endPosition": "3704",
+                  "kind": "STRING_LITERAL",
+                  "value": "parsernegativetests",
+                  "startPosition": "3685"
+                }
+              ],
+              "startPosition": "3671"
+            },
+            "endPosition": "3706",
+            "kind": "EXPRESSION_STATEMENT",
+            "startPosition": "3671"
+          },
+          {
+            "endPosition": "3775",
+            "kind": "VARIABLE",
+            "name": "script",
+            "startPosition": "3747",
+            "initializer": {
+              "endPosition": "3775",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "endPosition": "3765",
+                "kind": "IDENTIFIER",
+                "name": "readFully",
+                "startPosition": "3756"
+              },
+              "arguments": [
+                {
+                  "endPosition": "3774",
+                  "kind": "IDENTIFIER",
+                  "name": "__FILE__",
+                  "startPosition": "3766"
+                }
+              ],
+              "startPosition": "3756"
+            }
+          },
+          {
+            "endPosition": "3840",
+            "kind": "VARIABLE",
+            "name": "tree",
+            "startPosition": "3785",
+            "initializer": {
+              "endPosition": "3840",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "identifier": "parse",
+                "expression": {
+                  "constructorExpression": {
+                    "endPosition": "3804",
+                    "kind": "FUNCTION_INVOCATION",
+                    "functionSelect": {
+                      "endPosition": "3802",
+                      "kind": "IDENTIFIER",
+                      "name": "Parser",
+                      "startPosition": "3796"
+                    },
+                    "arguments": [],
+                    "startPosition": "3796"
+                  },
+                  "endPosition": "3804",
+                  "kind": "NEW",
+                  "startPosition": "3792"
+                },
+                "endPosition": "3810",
+                "kind": "MEMBER_SELECT",
+                "startPosition": "3792"
+              },
+              "arguments": [
+                {
+                  "endPosition": "3824",
+                  "kind": "STRING_LITERAL",
+                  "value": "parserapi.js",
+                  "startPosition": "3812"
+                },
+                {
+                  "endPosition": "3833",
+                  "kind": "IDENTIFIER",
+                  "name": "script",
+                  "startPosition": "3827"
+                },
+                {
+                  "endPosition": "3839",
+                  "kind": "NULL_LITERAL",
+                  "startPosition": "3835"
+                }
+              ],
+              "startPosition": "3792"
+            }
+          },
+          {
+            "expression": {
+              "endPosition": "3882",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "endPosition": "3851",
+                "kind": "IDENTIFIER",
+                "name": "print",
+                "startPosition": "3846"
+              },
+              "arguments": [
+                {
+                  "endPosition": "3881",
+                  "kind": "FUNCTION_INVOCATION",
+                  "functionSelect": {
+                    "identifier": "stringify",
+                    "expression": {
+                      "endPosition": "3856",
+                      "kind": "IDENTIFIER",
+                      "name": "JSON",
+                      "startPosition": "3852"
+                    },
+                    "endPosition": "3866",
+                    "kind": "MEMBER_SELECT",
+                    "startPosition": "3852"
+                  },
+                  "arguments": [
+                    {
+                      "endPosition": "3871",
+                      "kind": "IDENTIFIER",
+                      "name": "tree",
+                      "startPosition": "3867"
+                    },
+                    {
+                      "endPosition": "3877",
+                      "kind": "NULL_LITERAL",
+                      "startPosition": "3873"
+                    },
+                    {
+                      "endPosition": "3880",
+                      "kind": "NUMBER_LITERAL",
+                      "value": "2",
+                      "startPosition": "3879"
+                    }
+                  ],
+                  "startPosition": "3852"
+                }
+              ],
+              "startPosition": "3846"
+            },
+            "endPosition": "3882",
+            "kind": "EXPRESSION_STATEMENT",
+            "startPosition": "3846"
+          },
+          {
+            "expression": {
+              "endPosition": "3898",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "endPosition": "3893",
+                "kind": "IDENTIFIER",
+                "name": "print",
+                "startPosition": "3888"
+              },
+              "arguments": [
+                {
+                  "endPosition": "3896",
+                  "kind": "STRING_LITERAL",
+                  "value": "]",
+                  "startPosition": "3895"
+                }
+              ],
+              "startPosition": "3888"
+            },
+            "endPosition": "3898",
+            "kind": "EXPRESSION_STATEMENT",
+            "startPosition": "3888"
+          }
+        ],
+        "startPosition": "3615"
+      },
+      "strict": "false",
+      "startPosition": "3599",
+      "parameters": []
+    },
+    {
       "expression": {
         "endPosition": "3909",
         "kind": "FUNCTION_INVOCATION",