8068306: Tests for AST presentation Nashorn Parser API
authorslugovoy
Fri, 20 Mar 2015 13:19:47 +0300
changeset 29543 4d9f8f8b69a4
parent 29542 8a8ef9c75d2e
child 29544 8151437996be
8068306: Tests for AST presentation Nashorn Parser API 8068304: Tests for Diagnostic listener for Nashorn Parser API 8068303: Create tests for Nashorn Parser API for create Tree from some different source and parameters Reviewed-by: sundar, lagergren
nashorn/test/script/nosecurity/parser-args.js
nashorn/test/script/nosecurity/parser.js
nashorn/test/script/nosecurity/treeapi/array_access.js
nashorn/test/script/nosecurity/treeapi/array_access.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/array_literal.js
nashorn/test/script/nosecurity/treeapi/array_literal.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/assignment.js
nashorn/test/script/nosecurity/treeapi/assignment.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/assignmentExpr.js
nashorn/test/script/nosecurity/treeapi/assignmentExpr.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/binaryExpr.js
nashorn/test/script/nosecurity/treeapi/binaryExpr.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/block.js
nashorn/test/script/nosecurity/treeapi/block.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/breakStat.js
nashorn/test/script/nosecurity/treeapi/breakStat.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/case.js
nashorn/test/script/nosecurity/treeapi/case.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/compilationUnitTree.js
nashorn/test/script/nosecurity/treeapi/condExpr.js
nashorn/test/script/nosecurity/treeapi/condExpr.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/continueStat.js
nashorn/test/script/nosecurity/treeapi/continueStat.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/debuggerStat.js
nashorn/test/script/nosecurity/treeapi/debuggerStat.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/diagnostic.js
nashorn/test/script/nosecurity/treeapi/diagnostic.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/dowhile.js
nashorn/test/script/nosecurity/treeapi/dowhile.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/empty.js
nashorn/test/script/nosecurity/treeapi/empty.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/erroneous.js
nashorn/test/script/nosecurity/treeapi/erroneous.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/for.js
nashorn/test/script/nosecurity/treeapi/for.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/forin.js
nashorn/test/script/nosecurity/treeapi/forin.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/functionCall.js
nashorn/test/script/nosecurity/treeapi/functionCall.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/functionDeclaration.js
nashorn/test/script/nosecurity/treeapi/functionDeclaration.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/functionExpr.js
nashorn/test/script/nosecurity/treeapi/functionExpr.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/identifier.js
nashorn/test/script/nosecurity/treeapi/identifier.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/if.js
nashorn/test/script/nosecurity/treeapi/if.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/instanceof.js
nashorn/test/script/nosecurity/treeapi/instanceof.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/labelledStat.js
nashorn/test/script/nosecurity/treeapi/labelledStat.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/literal.js
nashorn/test/script/nosecurity/treeapi/literal.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/memberSelect.js
nashorn/test/script/nosecurity/treeapi/memberSelect.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/new.js
nashorn/test/script/nosecurity/treeapi/new.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/objectLiteral.js
nashorn/test/script/nosecurity/treeapi/objectLiteral.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/property.js
nashorn/test/script/nosecurity/treeapi/property.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/regexp.js
nashorn/test/script/nosecurity/treeapi/regexp.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/return.js
nashorn/test/script/nosecurity/treeapi/return.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/switch.js
nashorn/test/script/nosecurity/treeapi/switch.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/throw.js
nashorn/test/script/nosecurity/treeapi/throw.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/try.js
nashorn/test/script/nosecurity/treeapi/try.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/unary.js
nashorn/test/script/nosecurity/treeapi/unary.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/utils.js
nashorn/test/script/nosecurity/treeapi/variable.js
nashorn/test/script/nosecurity/treeapi/variable.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/while.js
nashorn/test/script/nosecurity/treeapi/while.js.EXPECTED
nashorn/test/script/nosecurity/treeapi/with.js
nashorn/test/script/nosecurity/treeapi/with.js.EXPECTED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/parser-args.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+ /**
+  * @bug 8068303
+  * @test
+  * @option -scripting
+  * @run
+  */
+
+load(__DIR__ + "/../assert.js")
+
+var Parser = Java.type('jdk.nashorn.api.tree.Parser')
+
+
+var code = <<EOF
+    const a= 1;
+EOF
+
+try {
+    Parser.create().parse("const.js", code, null)
+    fail("Parser need to throw exception there")
+} catch (e) {}
+
+try {
+    Parser.create("--const-as-var").parse("const.js", code, null)
+} catch (e) {
+    fail("Parser failed with exception :" + e)
+}
+
+var code = <<EOF
+    try {
+        that()
+    } catch (e if e instanceof TypeError) {
+        handle()
+    } catch (e) {
+        rest()
+    }
+EOF
+
+try {
+    Parser.create("-nse").parse("const.js", code, null)
+    fail("Parser need to throw exception there")
+} catch (e) {
+}
+
+try {
+    Parser.create().parse("extension.js", code, null)
+} catch (e) {
+    fail("Parser failed with exception :" + e)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/parser.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+
+ /**
+  * @test
+  * @bug 8068303
+  * @option -scripting
+  * @run
+  */
+
+load(__DIR__ + "/../assert.js")
+
+var Parser = Java.type('jdk.nashorn.api.tree.Parser')
+var Nashorn = Java.type('jdk.nashorn.api.scripting.NashornScriptEngineFactory')
+var File = java.io.File
+var Reader = java.io.FileReader
+
+
+var test_dir = __DIR__ + "/parsertests"
+var files = new File(test_dir).listFiles()
+
+// File source
+for (var i in files) {
+    var parser = Parser.create("-scripting", "--const-as-var", "-doe")
+    try {
+        var tree = parser.parse(files[i], null);
+        Assert.assertNotNull(tree);
+    }
+    catch (e) {
+        fail("Parser failed with message :" + e)
+    }
+}
+
+// Reader source
+for (var i in files) {
+    var parser =  Parser.create("-scripting", "--const-as-var", "-doe")
+    try {
+        var tree = parser.parse(files[i].getName(), new Reader(files[i]), null)
+        Assert.assertNotNull(tree);
+    } catch (e) {
+        fail("Parser failed with message :" + e)
+    }
+
+}
+
+// URL source
+for (var i in files) {
+    var parser =  Parser.create("-scripting", "--const-as-var", "-doe")
+    try {
+        var tree = parser.parse(files[i].toURI().toURL(), null)
+        Assert.assertNotNull(tree);
+    } catch (e) {
+        fail("Parser failed with message :" + e)
+    }
+}
+
+// ScriptObjectMirror
+
+for (var i in files) {
+    var parser =  Parser.create("-scripting", "--const-as-var", "-doe")
+    var engine = new Nashorn().getScriptEngine("-scripting", "--const-as-var", "-doe")
+    try {
+        engine.compile(new Reader(files[i]))
+        var mirror = engine.createBindings()
+        mirror['name'] = mirror['script'] = files[i].getName()
+        var tree = parser.parse(mirror, null)
+        Assert.assertNotNull(tree);
+    } catch (e) {
+        fail("Parser failed with message :" + e)
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/array_access.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation array access tree.
+ * 
+ * @bug 8068306
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+
+load(__DIR__ + "utils.js")
+
+var code = <<EOF
+    array[1]
+
+    { array[test()] }
+
+    function a () {
+        array[null]
+    }
+
+    var x = {
+        test1 : array[-1],
+        test2 : [array[array[NaN]]]
+    }
+EOF
+
+parse("array_access.js", code, "-nse", new (Java.extend(visitor, {
+    visitArrayAccess : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/array_access.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,109 @@
+[
+  {
+    "expression": {
+      "endPosition": "9",
+      "kind": "IDENTIFIER",
+      "name": "array",
+      "startPosition": "4"
+    },
+    "endPosition": "12",
+    "kind": "ARRAY_ACCESS",
+    "index": {
+      "endPosition": "11",
+      "kind": "NUMBER_LITERAL",
+      "value": "1",
+      "startPosition": "10"
+    },
+    "startPosition": "4"
+  },
+  {
+    "expression": {
+      "endPosition": "25",
+      "kind": "IDENTIFIER",
+      "name": "array",
+      "startPosition": "20"
+    },
+    "endPosition": "33",
+    "kind": "ARRAY_ACCESS",
+    "index": {
+      "endPosition": "32",
+      "kind": "FUNCTION_INVOCATION",
+      "functionSelect": {
+        "endPosition": "30",
+        "kind": "IDENTIFIER",
+        "name": "test",
+        "startPosition": "26"
+      },
+      "arguments": [],
+      "startPosition": "26"
+    },
+    "startPosition": "20"
+  },
+  {
+    "expression": {
+      "endPosition": "70",
+      "kind": "IDENTIFIER",
+      "name": "array",
+      "startPosition": "65"
+    },
+    "endPosition": "76",
+    "kind": "ARRAY_ACCESS",
+    "index": {
+      "endPosition": "75",
+      "kind": "NULL_LITERAL",
+      "value": "null",
+      "startPosition": "71"
+    },
+    "startPosition": "65"
+  },
+  {
+    "expression": {
+      "endPosition": "119",
+      "kind": "IDENTIFIER",
+      "name": "array",
+      "startPosition": "114"
+    },
+    "endPosition": "123",
+    "kind": "ARRAY_ACCESS",
+    "index": {
+      "expression": {
+        "endPosition": "122",
+        "kind": "NUMBER_LITERAL",
+        "value": "1",
+        "startPosition": "121"
+      },
+      "endPosition": "122",
+      "kind": "MINUS",
+      "startPosition": "120"
+    },
+    "startPosition": "114"
+  },
+  {
+    "expression": {
+      "endPosition": "147",
+      "kind": "IDENTIFIER",
+      "name": "array",
+      "startPosition": "142"
+    },
+    "endPosition": "159",
+    "kind": "ARRAY_ACCESS",
+    "index": {
+      "expression": {
+        "endPosition": "153",
+        "kind": "IDENTIFIER",
+        "name": "array",
+        "startPosition": "148"
+      },
+      "endPosition": "158",
+      "kind": "ARRAY_ACCESS",
+      "index": {
+        "endPosition": "157",
+        "kind": "IDENTIFIER",
+        "name": "NaN",
+        "startPosition": "154"
+      },
+      "startPosition": "148"
+    },
+    "startPosition": "142"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/array_literal.js	Fri Mar 20 13:19:47 2015 +0300
@@ -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.
+ */
+
+/**
+ * Tests to check representation array literal tree.
+ *
+ * @bug 8068306
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+var code = <<EOF
+
+var x = [];
+var y = [1, 43, 5, 45,];
+var z = [34,,,4];
+var k = [ {}, { x: 3 }, "hello" ];
+
+EOF
+
+
+parse("array_literal.js", code, "-nse", new (Java.extend(visitor, {
+    visitArrayLiteral : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/array_literal.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,105 @@
+[
+  {
+    "endPosition": "11",
+    "kind": "ARRAY_LITERAL",
+    "elements": [],
+    "startPosition": "9"
+  },
+  {
+    "endPosition": "36",
+    "kind": "ARRAY_LITERAL",
+    "elements": [
+      {
+        "endPosition": "23",
+        "kind": "NUMBER_LITERAL",
+        "value": "1",
+        "startPosition": "22"
+      },
+      {
+        "endPosition": "27",
+        "kind": "NUMBER_LITERAL",
+        "value": "43",
+        "startPosition": "25"
+      },
+      {
+        "endPosition": "30",
+        "kind": "NUMBER_LITERAL",
+        "value": "5",
+        "startPosition": "29"
+      },
+      {
+        "endPosition": "34",
+        "kind": "NUMBER_LITERAL",
+        "value": "45",
+        "startPosition": "32"
+      }
+    ],
+    "startPosition": "21"
+  },
+  {
+    "endPosition": "54",
+    "kind": "ARRAY_LITERAL",
+    "elements": [
+      {
+        "endPosition": "49",
+        "kind": "NUMBER_LITERAL",
+        "value": "34",
+        "startPosition": "47"
+      },
+      null,
+      null,
+      {
+        "endPosition": "53",
+        "kind": "NUMBER_LITERAL",
+        "value": "4",
+        "startPosition": "52"
+      }
+    ],
+    "startPosition": "46"
+  },
+  {
+    "endPosition": "89",
+    "kind": "ARRAY_LITERAL",
+    "elements": [
+      {
+        "endPosition": "68",
+        "kind": "OBJECT_LITERAL",
+        "startPosition": "66",
+        "properties": []
+      },
+      {
+        "endPosition": "78",
+        "kind": "OBJECT_LITERAL",
+        "startPosition": "70",
+        "properties": [
+          {
+            "getter": "null",
+            "endPosition": "74",
+            "kind": "PROPERTY",
+            "setter": "null",
+            "value": {
+              "endPosition": "76",
+              "kind": "NUMBER_LITERAL",
+              "value": "3",
+              "startPosition": "75"
+            },
+            "startPosition": "72",
+            "key": {
+              "endPosition": "73",
+              "kind": "IDENTIFIER",
+              "name": "x",
+              "startPosition": "72"
+            }
+          }
+        ]
+      },
+      {
+        "endPosition": "86",
+        "kind": "STRING_LITERAL",
+        "value": "hello",
+        "startPosition": "81"
+      }
+    ],
+    "startPosition": "64"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/assignment.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation assignment expression tree.
+ *
+ * @bug 8068306
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+var code = <<EOF
+a = 1
+b = 2;
+c = {}
+d = undefined
+e = NaN
+f = function () {}
+g = function () {"use strict";}
+
+EOF
+
+parse("assignment.js", code, "-nse", new (Java.extend(visitor, {
+    visitAssignment : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/assignment.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,149 @@
+[
+  {
+    "expression": {
+      "endPosition": "5",
+      "kind": "NUMBER_LITERAL",
+      "value": "1",
+      "startPosition": "4"
+    },
+    "endPosition": "5",
+    "kind": "ASSIGNMENT",
+    "variable": {
+      "endPosition": "1",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "0"
+    },
+    "startPosition": "0"
+  },
+  {
+    "expression": {
+      "endPosition": "11",
+      "kind": "NUMBER_LITERAL",
+      "value": "2",
+      "startPosition": "10"
+    },
+    "endPosition": "11",
+    "kind": "ASSIGNMENT",
+    "variable": {
+      "endPosition": "7",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "6"
+    },
+    "startPosition": "6"
+  },
+  {
+    "expression": {
+      "endPosition": "19",
+      "kind": "OBJECT_LITERAL",
+      "startPosition": "17",
+      "properties": []
+    },
+    "endPosition": "19",
+    "kind": "ASSIGNMENT",
+    "variable": {
+      "endPosition": "14",
+      "kind": "IDENTIFIER",
+      "name": "c",
+      "startPosition": "13"
+    },
+    "startPosition": "13"
+  },
+  {
+    "expression": {
+      "endPosition": "33",
+      "kind": "IDENTIFIER",
+      "name": "undefined",
+      "startPosition": "24"
+    },
+    "endPosition": "33",
+    "kind": "ASSIGNMENT",
+    "variable": {
+      "endPosition": "21",
+      "kind": "IDENTIFIER",
+      "name": "d",
+      "startPosition": "20"
+    },
+    "startPosition": "20"
+  },
+  {
+    "expression": {
+      "endPosition": "41",
+      "kind": "IDENTIFIER",
+      "name": "NaN",
+      "startPosition": "38"
+    },
+    "endPosition": "41",
+    "kind": "ASSIGNMENT",
+    "variable": {
+      "endPosition": "35",
+      "kind": "IDENTIFIER",
+      "name": "e",
+      "startPosition": "34"
+    },
+    "startPosition": "34"
+  },
+  {
+    "expression": {
+      "endPosition": "58",
+      "kind": "FUNCTION_EXPRESSION",
+      "name": "null",
+      "body": {
+        "endPosition": "59",
+        "kind": "BLOCK",
+        "statements": [],
+        "startPosition": "58"
+      },
+      "strict": "false",
+      "startPosition": "58",
+      "parameters": []
+    },
+    "endPosition": "58",
+    "kind": "ASSIGNMENT",
+    "variable": {
+      "endPosition": "43",
+      "kind": "IDENTIFIER",
+      "name": "f",
+      "startPosition": "42"
+    },
+    "startPosition": "42"
+  },
+  {
+    "expression": {
+      "endPosition": "77",
+      "kind": "FUNCTION_EXPRESSION",
+      "name": "null",
+      "body": {
+        "endPosition": "91",
+        "kind": "BLOCK",
+        "statements": [
+          {
+            "expression": {
+              "endPosition": "89",
+              "kind": "STRING_LITERAL",
+              "value": "use strict",
+              "startPosition": "79"
+            },
+            "endPosition": "89",
+            "kind": "EXPRESSION_STATEMENT",
+            "startPosition": "79"
+          }
+        ],
+        "startPosition": "77"
+      },
+      "strict": "true",
+      "startPosition": "77",
+      "parameters": []
+    },
+    "endPosition": "77",
+    "kind": "ASSIGNMENT",
+    "variable": {
+      "endPosition": "62",
+      "kind": "IDENTIFIER",
+      "name": "g",
+      "startPosition": "61"
+    },
+    "startPosition": "61"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/assignmentExpr.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,55 @@
+/*
+* 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.
+*/
+
+/**
+ * Tests to check representation assignment expression tree.
+ *
+ * @bug 8068306
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+var code = <<EOF
+xyz += 314;
+xyz -= 314;
+xyz *= 314;
+xyz /= 314;
+xyz %= 314;
+xyz <<= 314;
+xyz >>= 314;
+xyz >>>= 314;
+xyz &= 314;
+xyz ^= 314;
+xyz |= 314;
+
+EOF
+
+
+parse("assignmentExpr.js", code, "-nse", new (Java.extend(visitor, {
+    visitCompoundAssignment : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/assignmentExpr.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,189 @@
+[
+  {
+    "expression": {
+      "endPosition": "10",
+      "kind": "NUMBER_LITERAL",
+      "value": "314",
+      "startPosition": "7"
+    },
+    "endPosition": "10",
+    "kind": "PLUS_ASSIGNMENT",
+    "variable": {
+      "endPosition": "3",
+      "kind": "IDENTIFIER",
+      "name": "xyz",
+      "startPosition": "0"
+    },
+    "startPosition": "0"
+  },
+  {
+    "expression": {
+      "endPosition": "22",
+      "kind": "NUMBER_LITERAL",
+      "value": "314",
+      "startPosition": "19"
+    },
+    "endPosition": "22",
+    "kind": "MINUS_ASSIGNMENT",
+    "variable": {
+      "endPosition": "15",
+      "kind": "IDENTIFIER",
+      "name": "xyz",
+      "startPosition": "12"
+    },
+    "startPosition": "12"
+  },
+  {
+    "expression": {
+      "endPosition": "34",
+      "kind": "NUMBER_LITERAL",
+      "value": "314",
+      "startPosition": "31"
+    },
+    "endPosition": "34",
+    "kind": "MULTIPLY_ASSIGNMENT",
+    "variable": {
+      "endPosition": "27",
+      "kind": "IDENTIFIER",
+      "name": "xyz",
+      "startPosition": "24"
+    },
+    "startPosition": "24"
+  },
+  {
+    "expression": {
+      "endPosition": "46",
+      "kind": "NUMBER_LITERAL",
+      "value": "314",
+      "startPosition": "43"
+    },
+    "endPosition": "46",
+    "kind": "DIVIDE_ASSIGNMENT",
+    "variable": {
+      "endPosition": "39",
+      "kind": "IDENTIFIER",
+      "name": "xyz",
+      "startPosition": "36"
+    },
+    "startPosition": "36"
+  },
+  {
+    "expression": {
+      "endPosition": "58",
+      "kind": "NUMBER_LITERAL",
+      "value": "314",
+      "startPosition": "55"
+    },
+    "endPosition": "58",
+    "kind": "REMAINDER_ASSIGNMENT",
+    "variable": {
+      "endPosition": "51",
+      "kind": "IDENTIFIER",
+      "name": "xyz",
+      "startPosition": "48"
+    },
+    "startPosition": "48"
+  },
+  {
+    "expression": {
+      "endPosition": "71",
+      "kind": "NUMBER_LITERAL",
+      "value": "314",
+      "startPosition": "68"
+    },
+    "endPosition": "71",
+    "kind": "LEFT_SHIFT_ASSIGNMENT",
+    "variable": {
+      "endPosition": "63",
+      "kind": "IDENTIFIER",
+      "name": "xyz",
+      "startPosition": "60"
+    },
+    "startPosition": "60"
+  },
+  {
+    "expression": {
+      "endPosition": "84",
+      "kind": "NUMBER_LITERAL",
+      "value": "314",
+      "startPosition": "81"
+    },
+    "endPosition": "84",
+    "kind": "RIGHT_SHIFT_ASSIGNMENT",
+    "variable": {
+      "endPosition": "76",
+      "kind": "IDENTIFIER",
+      "name": "xyz",
+      "startPosition": "73"
+    },
+    "startPosition": "73"
+  },
+  {
+    "expression": {
+      "endPosition": "98",
+      "kind": "NUMBER_LITERAL",
+      "value": "314",
+      "startPosition": "95"
+    },
+    "endPosition": "98",
+    "kind": "UNSIGNED_RIGHT_SHIFT_ASSIGNMENT",
+    "variable": {
+      "endPosition": "89",
+      "kind": "IDENTIFIER",
+      "name": "xyz",
+      "startPosition": "86"
+    },
+    "startPosition": "86"
+  },
+  {
+    "expression": {
+      "endPosition": "110",
+      "kind": "NUMBER_LITERAL",
+      "value": "314",
+      "startPosition": "107"
+    },
+    "endPosition": "110",
+    "kind": "AND_ASSIGNMENT",
+    "variable": {
+      "endPosition": "103",
+      "kind": "IDENTIFIER",
+      "name": "xyz",
+      "startPosition": "100"
+    },
+    "startPosition": "100"
+  },
+  {
+    "expression": {
+      "endPosition": "122",
+      "kind": "NUMBER_LITERAL",
+      "value": "314",
+      "startPosition": "119"
+    },
+    "endPosition": "122",
+    "kind": "XOR_ASSIGNMENT",
+    "variable": {
+      "endPosition": "115",
+      "kind": "IDENTIFIER",
+      "name": "xyz",
+      "startPosition": "112"
+    },
+    "startPosition": "112"
+  },
+  {
+    "expression": {
+      "endPosition": "134",
+      "kind": "NUMBER_LITERAL",
+      "value": "314",
+      "startPosition": "131"
+    },
+    "endPosition": "134",
+    "kind": "OR_ASSIGNMENT",
+    "variable": {
+      "endPosition": "127",
+      "kind": "IDENTIFIER",
+      "name": "xyz",
+      "startPosition": "124"
+    },
+    "startPosition": "124"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/binaryExpr.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * Tests to check representation binary expression tree.
+ *
+ * @bug 8068306
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+var code = <<EOF
+a * b
+a / b;
+a % b;
+a + b;
+a - b;
+a << b;
+a >> b;
+a >>> b;
+a < b;
+a > b;
+a <= b;
+a >= b;
+a instanceof b;
+a == b;
+a != b;
+a === b;
+a !== b;
+a & b;
+a ^ b;
+a | b;
+a && b;
+a || b;
+
+EOF
+
+
+parse("binaryExpr.js", code, "-nse", new (Java.extend(visitor, {
+    visitBinary : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/binaryExpr.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,359 @@
+[
+  {
+    "leftOperand": {
+      "endPosition": "1",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "0"
+    },
+    "endPosition": "5",
+    "kind": "MULTIPLY",
+    "rightOperand": {
+      "endPosition": "5",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "4"
+    },
+    "startPosition": "0"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "7",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "6"
+    },
+    "endPosition": "11",
+    "kind": "DIVIDE",
+    "rightOperand": {
+      "endPosition": "11",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "10"
+    },
+    "startPosition": "6"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "14",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "13"
+    },
+    "endPosition": "18",
+    "kind": "REMAINDER",
+    "rightOperand": {
+      "endPosition": "18",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "17"
+    },
+    "startPosition": "13"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "21",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "20"
+    },
+    "endPosition": "25",
+    "kind": "PLUS",
+    "rightOperand": {
+      "endPosition": "25",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "24"
+    },
+    "startPosition": "20"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "28",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "27"
+    },
+    "endPosition": "32",
+    "kind": "MINUS",
+    "rightOperand": {
+      "endPosition": "32",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "31"
+    },
+    "startPosition": "27"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "35",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "34"
+    },
+    "endPosition": "40",
+    "kind": "LEFT_SHIFT",
+    "rightOperand": {
+      "endPosition": "40",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "39"
+    },
+    "startPosition": "34"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "43",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "42"
+    },
+    "endPosition": "48",
+    "kind": "RIGHT_SHIFT",
+    "rightOperand": {
+      "endPosition": "48",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "47"
+    },
+    "startPosition": "42"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "51",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "50"
+    },
+    "endPosition": "57",
+    "kind": "UNSIGNED_RIGHT_SHIFT",
+    "rightOperand": {
+      "endPosition": "57",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "56"
+    },
+    "startPosition": "50"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "60",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "59"
+    },
+    "endPosition": "64",
+    "kind": "LESS_THAN",
+    "rightOperand": {
+      "endPosition": "64",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "63"
+    },
+    "startPosition": "59"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "67",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "66"
+    },
+    "endPosition": "71",
+    "kind": "GREATER_THAN",
+    "rightOperand": {
+      "endPosition": "71",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "70"
+    },
+    "startPosition": "66"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "74",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "73"
+    },
+    "endPosition": "79",
+    "kind": "LESS_THAN_EQUAL",
+    "rightOperand": {
+      "endPosition": "79",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "78"
+    },
+    "startPosition": "73"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "82",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "81"
+    },
+    "endPosition": "87",
+    "kind": "GREATER_THAN_EQUAL",
+    "rightOperand": {
+      "endPosition": "87",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "86"
+    },
+    "startPosition": "81"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "106",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "105"
+    },
+    "endPosition": "111",
+    "kind": "EQUAL_TO",
+    "rightOperand": {
+      "endPosition": "111",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "110"
+    },
+    "startPosition": "105"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "114",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "113"
+    },
+    "endPosition": "119",
+    "kind": "NOT_EQUAL_TO",
+    "rightOperand": {
+      "endPosition": "119",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "118"
+    },
+    "startPosition": "113"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "122",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "121"
+    },
+    "endPosition": "128",
+    "kind": "STRICT_EQUAL_TO",
+    "rightOperand": {
+      "endPosition": "128",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "127"
+    },
+    "startPosition": "121"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "131",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "130"
+    },
+    "endPosition": "137",
+    "kind": "STRICT_NOT_EQUAL_TO",
+    "rightOperand": {
+      "endPosition": "137",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "136"
+    },
+    "startPosition": "130"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "140",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "139"
+    },
+    "endPosition": "144",
+    "kind": "AND",
+    "rightOperand": {
+      "endPosition": "144",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "143"
+    },
+    "startPosition": "139"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "147",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "146"
+    },
+    "endPosition": "151",
+    "kind": "XOR",
+    "rightOperand": {
+      "endPosition": "151",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "150"
+    },
+    "startPosition": "146"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "154",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "153"
+    },
+    "endPosition": "158",
+    "kind": "OR",
+    "rightOperand": {
+      "endPosition": "158",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "157"
+    },
+    "startPosition": "153"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "161",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "160"
+    },
+    "endPosition": "166",
+    "kind": "CONDITIONAL_AND",
+    "rightOperand": {
+      "endPosition": "166",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "165"
+    },
+    "startPosition": "160"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "169",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "168"
+    },
+    "endPosition": "174",
+    "kind": "CONDITIONAL_OR",
+    "rightOperand": {
+      "endPosition": "174",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "173"
+    },
+    "startPosition": "168"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/block.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * Tests to check representation block tree.
+ *
+ * @bug 8068306
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+var code = <<EOF
+{}
+{ print("hello"); }
+function a () {
+    return 2 + 1;
+}
+EOF
+
+
+parse("block.js", code, "-nse", new (Java.extend(visitor, {
+    visitBlock : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/block.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,68 @@
+[
+  {
+    "endPosition": "2",
+    "kind": "BLOCK",
+    "statements": [],
+    "startPosition": "0"
+  },
+  {
+    "endPosition": "22",
+    "kind": "BLOCK",
+    "statements": [
+      {
+        "expression": {
+          "endPosition": "19",
+          "kind": "FUNCTION_INVOCATION",
+          "functionSelect": {
+            "endPosition": "10",
+            "kind": "IDENTIFIER",
+            "name": "print",
+            "startPosition": "5"
+          },
+          "arguments": [
+            {
+              "endPosition": "17",
+              "kind": "STRING_LITERAL",
+              "value": "hello",
+              "startPosition": "12"
+            }
+          ],
+          "startPosition": "5"
+        },
+        "endPosition": "19",
+        "kind": "EXPRESSION_STATEMENT",
+        "startPosition": "5"
+      }
+    ],
+    "startPosition": "3"
+  },
+  {
+    "endPosition": "56",
+    "kind": "BLOCK",
+    "statements": [
+      {
+        "expression": {
+          "leftOperand": {
+            "endPosition": "51",
+            "kind": "NUMBER_LITERAL",
+            "value": "2",
+            "startPosition": "50"
+          },
+          "endPosition": "55",
+          "kind": "PLUS",
+          "rightOperand": {
+            "endPosition": "55",
+            "kind": "NUMBER_LITERAL",
+            "value": "1",
+            "startPosition": "54"
+          },
+          "startPosition": "50"
+        },
+        "endPosition": "56",
+        "kind": "RETURN",
+        "startPosition": "43"
+      }
+    ],
+    "startPosition": "37"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/breakStat.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation break statement tree.
+ *
+ * @bug 8068306
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+var code = <<EOF
+while (true) { break; };
+loop: { while (true) { break loop } };
+loop: { for (;;) { break loop } };
+do break; while(true)
+switch(a) {
+    case 1:
+    case 2:
+        break
+    default:
+        break;
+}
+
+
+EOF
+
+
+parse("breakStat.js", code, "-nse", new (Java.extend(visitor, {
+    visitBreak : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/breakStat.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,38 @@
+[
+  {
+    "endPosition": "21",
+    "kind": "BREAK",
+    "label": "null",
+    "startPosition": "15"
+  },
+  {
+    "endPosition": "58",
+    "kind": "BREAK",
+    "label": "loop",
+    "startPosition": "48"
+  },
+  {
+    "endPosition": "93",
+    "kind": "BREAK",
+    "label": "loop",
+    "startPosition": "83"
+  },
+  {
+    "endPosition": "108",
+    "kind": "BREAK",
+    "label": "null",
+    "startPosition": "102"
+  },
+  {
+    "endPosition": "170",
+    "kind": "BREAK",
+    "label": "null",
+    "startPosition": "165"
+  },
+  {
+    "endPosition": "198",
+    "kind": "BREAK",
+    "label": "null",
+    "startPosition": "192"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/case.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation case tree.
+ *
+ * @bug 8068306
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+var code = <<EOF
+switch (e) {
+    case 1:
+    case 2:
+    case 3:
+        break; 
+    default:
+}
+label:
+switch (a) {
+    case 1:
+        break
+    case 2:
+        break label
+    case 3:
+        break
+}
+
+EOF
+
+parse("breakStat.js", code, "-nse", new (Java.extend(visitor, {
+    visitCase : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/case.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,109 @@
+[
+  {
+    "expression": {
+      "endPosition": "23",
+      "kind": "NUMBER_LITERAL",
+      "value": "1",
+      "startPosition": "22"
+    },
+    "endPosition": "24",
+    "kind": "CASE",
+    "statements": [],
+    "startPosition": "17"
+  },
+  {
+    "expression": {
+      "endPosition": "35",
+      "kind": "NUMBER_LITERAL",
+      "value": "2",
+      "startPosition": "34"
+    },
+    "endPosition": "36",
+    "kind": "CASE",
+    "statements": [],
+    "startPosition": "29"
+  },
+  {
+    "expression": {
+      "endPosition": "47",
+      "kind": "NUMBER_LITERAL",
+      "value": "3",
+      "startPosition": "46"
+    },
+    "endPosition": "63",
+    "kind": "CASE",
+    "statements": [
+      {
+        "endPosition": "63",
+        "kind": "BREAK",
+        "label": "null",
+        "startPosition": "57"
+      }
+    ],
+    "startPosition": "41"
+  },
+  {
+    "expression": "null",
+    "endPosition": "77",
+    "kind": "CASE",
+    "statements": [],
+    "startPosition": "69"
+  },
+  {
+    "expression": {
+      "endPosition": "110",
+      "kind": "NUMBER_LITERAL",
+      "value": "1",
+      "startPosition": "109"
+    },
+    "endPosition": "125",
+    "kind": "CASE",
+    "statements": [
+      {
+        "endPosition": "125",
+        "kind": "BREAK",
+        "label": "null",
+        "startPosition": "120"
+      }
+    ],
+    "startPosition": "104"
+  },
+  {
+    "expression": {
+      "endPosition": "136",
+      "kind": "NUMBER_LITERAL",
+      "value": "2",
+      "startPosition": "135"
+    },
+    "endPosition": "157",
+    "kind": "CASE",
+    "statements": [
+      {
+        "endPosition": "157",
+        "kind": "BREAK",
+        "label": "label",
+        "startPosition": "146"
+      }
+    ],
+    "startPosition": "130"
+  },
+  {
+    "expression": {
+      "endPosition": "168",
+      "kind": "NUMBER_LITERAL",
+      "value": "3",
+      "startPosition": "167"
+    },
+    "endPosition": "183",
+    "kind": "CASE",
+    "statements": [
+      {
+        "endPosition": "183",
+        "kind": "BREAK",
+        "label": "null",
+        "startPosition": "178"
+      }
+    ],
+    "startPosition": "162"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/compilationUnitTree.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check all tree
+ *
+ * @bug 8068306
+ * @subtest
+ */
+
+var a = 1
+var b = function () {
+    print(a)
+}
+
+var c = {
+    x : function (a, b, c) {
+        return a * b - c;
+    },
+    i : []
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/condExpr.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation case tree.
+ *
+ * @bug 8068306
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+var code = <<EOF
+
+a? b : c;
+
+EOF
+
+parse("condExpr.js", code, "-nse", new (Java.extend(visitor, {
+    visitConditionalExpression : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/condExpr.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,25 @@
+[
+  {
+    "condition": {
+      "endPosition": "2",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "1"
+    },
+    "endPosition": "9",
+    "kind": "CONDITIONAL_EXPRESSION",
+    "trueExpression": {
+      "endPosition": "5",
+      "kind": "IDENTIFIER",
+      "name": "b",
+      "startPosition": "4"
+    },
+    "falseExpression": {
+      "endPosition": "9",
+      "kind": "IDENTIFIER",
+      "name": "c",
+      "startPosition": "8"
+    },
+    "startPosition": "2"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/continueStat.js	Fri Mar 20 13:19:47 2015 +0300
@@ -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.
+ */
+
+/**
+ * Tests to check representation continue tree.
+ *
+ * @bug 8068306
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+var code = <<EOF
+
+while (true) { continue; };
+begin: { while (true) { continue begin; } };
+start: { for(;;) { continue start; } };
+do continue; while(false)
+label:do continue label; while(true)
+
+EOF
+
+parse("continueStat.js", code, "-nse", new (Java.extend(visitor, {
+    visitContinue : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/continueStat.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,32 @@
+[
+  {
+    "endPosition": "25",
+    "kind": "CONTINUE",
+    "label": "null",
+    "startPosition": "16"
+  },
+  {
+    "endPosition": "68",
+    "kind": "CONTINUE",
+    "label": "begin",
+    "startPosition": "53"
+  },
+  {
+    "endPosition": "108",
+    "kind": "CONTINUE",
+    "label": "start",
+    "startPosition": "93"
+  },
+  {
+    "endPosition": "126",
+    "kind": "CONTINUE",
+    "label": "null",
+    "startPosition": "117"
+  },
+  {
+    "endPosition": "164",
+    "kind": "CONTINUE",
+    "label": "label",
+    "startPosition": "149"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/debuggerStat.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation continue tree.
+ *
+ * @bug 8068306
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+debugger;
+
+EOF
+
+parse("debugger.js", code, "-nse", new (Java.extend(visitor, {
+    visitDebugger : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/debuggerStat.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,7 @@
+[
+  {
+    "endPosition": "9",
+    "kind": "DEBUGGER",
+    "startPosition": "0"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/diagnostic.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8068304
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__  + "utils.js")
+
+var code = <<EOF
+    var a = { k:1, k:2 }
+EOF
+
+parseDiagnostic(code, "-strict")
+
+var code = <<EOF
+    var x = {}
+    with(x) {}
+EOF
+
+parseDiagnostic(code, "-strict")
+
+var code = <<EOF
+    var eval = "test value";
+EOF
+
+parseDiagnostic(code, "-strict")
+
+var code = <<EOF
+    var arguments = "test value";
+EOF
+
+parseDiagnostic(code, "-strict")
+
+var code = <<EOF
+    	if (true) {
+    		function a () {}
+    	}
+EOF
+
+parseDiagnostic(code, "-strict")
+
+var code = <<EOF
+    var a = { get x() {}, get x() {}};
+    var a = { set x() {}, set x() {}};
+EOF
+
+parseDiagnostic(code, "-strict")
+
+var code = <<EOF
+    /([a-z])+(/;
+    /([a-z])+/h;
+EOF
+
+parseDiagnostic(code, "-strict")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/diagnostic.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,95 @@
+[
+  {
+    "fileName": "test.js",
+    "code": "ident (19, 1)",
+    "columnNumber": "19",
+    "kind": "ERROR",
+    "position": "19",
+    "message": "test.js:1:19 Property \"k\" already defined\n    var a = { k:1, k:2 }\n                   ^",
+    "lineNumber": "1"
+  }
+]
+[
+  {
+    "fileName": "test.js",
+    "code": "with (19, 4)",
+    "columnNumber": "4",
+    "kind": "ERROR",
+    "position": "19",
+    "message": "test.js:2:4 \"with\" statement cannot be used in strict mode\n    with(x) {}\n    ^",
+    "lineNumber": "2"
+  }
+]
+[
+  {
+    "fileName": "test.js",
+    "code": "ident (8, 4)",
+    "columnNumber": "8",
+    "kind": "ERROR",
+    "position": "8",
+    "message": "test.js:1:8 \"eval\" cannot be used as variable name in strict mode\n    var eval = \"test value\";\n        ^",
+    "lineNumber": "1"
+  }
+]
+[
+  {
+    "fileName": "test.js",
+    "code": "ident (8, 9)",
+    "columnNumber": "8",
+    "kind": "ERROR",
+    "position": "8",
+    "message": "test.js:1:8 \"arguments\" cannot be used as variable name in strict mode\n    var arguments = \"test value\";\n        ^",
+    "lineNumber": "1"
+  }
+]
+[
+  {
+    "fileName": "test.js",
+    "code": "function (23, 8)",
+    "columnNumber": "6",
+    "kind": "ERROR",
+    "position": "23",
+    "message": "test.js:2:6 In strict mode, function declarations can only occur at program or function body level. You should use a function expression here instead.\n    \t\tfunction a () {}\n    \t\t^",
+    "lineNumber": "2"
+  }
+]
+[
+  {
+    "fileName": "test.js",
+    "code": "ident (26, 3)",
+    "columnNumber": "26",
+    "kind": "ERROR",
+    "position": "26",
+    "message": "test.js:1:26 Property \"x\" already defined\n    var a = { get x() {}, get x() {}};\n                          ^",
+    "lineNumber": "1"
+  },
+  {
+    "fileName": "test.js",
+    "code": "ident (65, 3)",
+    "columnNumber": "26",
+    "kind": "ERROR",
+    "position": "65",
+    "message": "test.js:2:26 Property \"x\" already defined\n    var a = { set x() {}, set x() {}};\n                          ^",
+    "lineNumber": "2"
+  }
+]
+[
+  {
+    "fileName": "test.js",
+    "code": "; (15, 1)",
+    "columnNumber": "15",
+    "kind": "ERROR",
+    "position": "15",
+    "message": "test.js:1:15 Unclosed group near index 9\n([a-z])+(\n         ^\n    /([a-z])+(/;\n               ^",
+    "lineNumber": "1"
+  },
+  {
+    "fileName": "test.js",
+    "code": "; (32, 1)",
+    "columnNumber": "15",
+    "kind": "ERROR",
+    "position": "32",
+    "message": "test.js:2:15 Unsupported RegExp flag: h\n    /([a-z])+/h;\n               ^",
+    "lineNumber": "2"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/dowhile.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation continue tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+do {} while(false)
+do {break;} while(true)
+label:
+do {break label;} while(a == 2)
+do{do{}while(func1())}while(a + b > 20)
+
+do call();while(NaN)
+
+EOF
+
+parse("dowhile.js", code, "-nse", new (Java.extend(visitor, {
+    visitDoWhileLoop : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/dowhile.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,169 @@
+[
+  {
+    "condition": {
+      "endPosition": "18",
+      "kind": "BOOLEAN_LITERAL",
+      "value": "false",
+      "startPosition": "13"
+    },
+    "endPosition": "19",
+    "kind": "DO_WHILE_LOOP",
+    "statement": {
+      "endPosition": "6",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "4"
+    },
+    "startPosition": "1"
+  },
+  {
+    "condition": {
+      "endPosition": "42",
+      "kind": "BOOLEAN_LITERAL",
+      "value": "true",
+      "startPosition": "38"
+    },
+    "endPosition": "43",
+    "kind": "DO_WHILE_LOOP",
+    "statement": {
+      "endPosition": "31",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "endPosition": "30",
+          "kind": "BREAK",
+          "label": "null",
+          "startPosition": "24"
+        }
+      ],
+      "startPosition": "23"
+    },
+    "startPosition": "20"
+  },
+  {
+    "condition": {
+      "leftOperand": {
+        "endPosition": "76",
+        "kind": "IDENTIFIER",
+        "name": "a",
+        "startPosition": "75"
+      },
+      "endPosition": "81",
+      "kind": "EQUAL_TO",
+      "rightOperand": {
+        "endPosition": "81",
+        "kind": "NUMBER_LITERAL",
+        "value": "2",
+        "startPosition": "80"
+      },
+      "startPosition": "75"
+    },
+    "endPosition": "82",
+    "kind": "DO_WHILE_LOOP",
+    "statement": {
+      "endPosition": "68",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "endPosition": "67",
+          "kind": "BREAK",
+          "label": "label",
+          "startPosition": "55"
+        }
+      ],
+      "startPosition": "54"
+    },
+    "startPosition": "51"
+  },
+  {
+    "condition": {
+      "leftOperand": {
+        "leftOperand": {
+          "endPosition": "112",
+          "kind": "IDENTIFIER",
+          "name": "a",
+          "startPosition": "111"
+        },
+        "endPosition": "116",
+        "kind": "PLUS",
+        "rightOperand": {
+          "endPosition": "116",
+          "kind": "IDENTIFIER",
+          "name": "b",
+          "startPosition": "115"
+        },
+        "startPosition": "111"
+      },
+      "endPosition": "121",
+      "kind": "GREATER_THAN",
+      "rightOperand": {
+        "endPosition": "121",
+        "kind": "NUMBER_LITERAL",
+        "value": "20",
+        "startPosition": "119"
+      },
+      "startPosition": "111"
+    },
+    "endPosition": "122",
+    "kind": "DO_WHILE_LOOP",
+    "statement": {
+      "endPosition": "105",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "condition": {
+            "endPosition": "103",
+            "kind": "FUNCTION_INVOCATION",
+            "functionSelect": {
+              "endPosition": "101",
+              "kind": "IDENTIFIER",
+              "name": "func1",
+              "startPosition": "96"
+            },
+            "arguments": [],
+            "startPosition": "96"
+          },
+          "endPosition": "104",
+          "kind": "DO_WHILE_LOOP",
+          "statement": {
+            "endPosition": "90",
+            "kind": "BLOCK",
+            "statements": [],
+            "startPosition": "88"
+          },
+          "startPosition": "86"
+        }
+      ],
+      "startPosition": "85"
+    },
+    "startPosition": "83"
+  },
+  {
+    "condition": {
+      "endPosition": "143",
+      "kind": "IDENTIFIER",
+      "name": "NaN",
+      "startPosition": "140"
+    },
+    "endPosition": "144",
+    "kind": "DO_WHILE_LOOP",
+    "statement": {
+      "expression": {
+        "endPosition": "133",
+        "kind": "FUNCTION_INVOCATION",
+        "functionSelect": {
+          "endPosition": "131",
+          "kind": "IDENTIFIER",
+          "name": "call",
+          "startPosition": "127"
+        },
+        "arguments": [],
+        "startPosition": "127"
+      },
+      "endPosition": "133",
+      "kind": "EXPRESSION_STATEMENT",
+      "startPosition": "127"
+    },
+    "startPosition": "124"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/empty.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation empty tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+;
+var a = 1;;
+1;
+
+EOF
+
+parse("empty.js", code, "--empty-statements", new (Java.extend(visitor, {
+    visitEmptyStatement : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/empty.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,12 @@
+[
+  {
+    "endPosition": "2",
+    "kind": "EMPTY_STATEMENT",
+    "startPosition": "1"
+  },
+  {
+    "endPosition": "14",
+    "kind": "EMPTY_STATEMENT",
+    "startPosition": "13"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/erroneous.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation erroneous tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+(1 + 2;
+x *;
+while;
+break;
+continue;
+
+EOF
+
+
+
+parse("erroneous.js", code, "-nse", new (Java.extend(visitor, {
+    visitErroneous : function (node, obj) {
+        obj.push(convert(node))
+    }
+})), function (message) {})
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/erroneous.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,27 @@
+[
+  {
+    "endPosition": "8",
+    "kind": "ERROR",
+    "startPosition": "7"
+  },
+  {
+    "endPosition": "13",
+    "kind": "ERROR",
+    "startPosition": "12"
+  },
+  {
+    "endPosition": "20",
+    "kind": "ERROR",
+    "startPosition": "19"
+  },
+  {
+    "endPosition": "27",
+    "kind": "ERROR",
+    "startPosition": "26"
+  },
+  {
+    "endPosition": "37",
+    "kind": "ERROR",
+    "startPosition": "36"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/for.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
+ * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ *
+ * This code is free softw1re; you c1n redistri2ute it 1nd/or modify it
+ * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
+ * pu2lished 2y the Free Softw1re Found1tion.
+ *
+ * This code is distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
+ * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
+ * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
+ * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
+ * 1ccomp1nied this code).
+ *
+ * You should h1ve received 1 copy of the GNU Gener1l Pu2lic License version
+ * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
+ * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ *
+ * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
+ * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * questions.
+ */
+
+/**
+ * Tests to check representation for loop tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+for (i=0; someExpr;) {}
+for(;;){}
+for(var i=0; i < 4; i+=5) {}
+for(var i=0; i < 4; i++) {}
+for(i=0, j=2, x=4; x < 6; j++, x+=2, i*=x) {}
+
+EOF
+
+parse("forloop.js", code, "-nse", new (Java.extend(visitor, {
+    visitForLoop : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/for.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,281 @@
+[
+  {
+    "condition": {
+      "endPosition": "19",
+      "kind": "IDENTIFIER",
+      "name": "someExpr",
+      "startPosition": "11"
+    },
+    "endPosition": "24",
+    "kind": "FOR_LOOP",
+    "statement": {
+      "endPosition": "24",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "22"
+    },
+    "update": "null",
+    "startPosition": "1",
+    "initializer": {
+      "expression": {
+        "endPosition": "9",
+        "kind": "NUMBER_LITERAL",
+        "value": "0",
+        "startPosition": "8"
+      },
+      "endPosition": "9",
+      "kind": "ASSIGNMENT",
+      "variable": {
+        "endPosition": "7",
+        "kind": "IDENTIFIER",
+        "name": "i",
+        "startPosition": "6"
+      },
+      "startPosition": "6"
+    }
+  },
+  {
+    "condition": "null",
+    "endPosition": "34",
+    "kind": "FOR_LOOP",
+    "statement": {
+      "endPosition": "34",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "32"
+    },
+    "update": "null",
+    "startPosition": "25",
+    "initializer": "null"
+  },
+  {
+    "condition": {
+      "leftOperand": {
+        "endPosition": "49",
+        "kind": "IDENTIFIER",
+        "name": "i",
+        "startPosition": "48"
+      },
+      "endPosition": "53",
+      "kind": "LESS_THAN",
+      "rightOperand": {
+        "endPosition": "53",
+        "kind": "NUMBER_LITERAL",
+        "value": "4",
+        "startPosition": "52"
+      },
+      "startPosition": "48"
+    },
+    "endPosition": "63",
+    "kind": "FOR_LOOP",
+    "statement": {
+      "endPosition": "63",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "61"
+    },
+    "update": {
+      "expression": {
+        "endPosition": "59",
+        "kind": "NUMBER_LITERAL",
+        "value": "5",
+        "startPosition": "58"
+      },
+      "endPosition": "59",
+      "kind": "PLUS_ASSIGNMENT",
+      "variable": {
+        "endPosition": "56",
+        "kind": "IDENTIFIER",
+        "name": "i",
+        "startPosition": "55"
+      },
+      "startPosition": "55"
+    },
+    "startPosition": "35",
+    "initializer": "null"
+  },
+  {
+    "condition": {
+      "leftOperand": {
+        "endPosition": "78",
+        "kind": "IDENTIFIER",
+        "name": "i",
+        "startPosition": "77"
+      },
+      "endPosition": "82",
+      "kind": "LESS_THAN",
+      "rightOperand": {
+        "endPosition": "82",
+        "kind": "NUMBER_LITERAL",
+        "value": "4",
+        "startPosition": "81"
+      },
+      "startPosition": "77"
+    },
+    "endPosition": "91",
+    "kind": "FOR_LOOP",
+    "statement": {
+      "endPosition": "91",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "89"
+    },
+    "update": {
+      "expression": {
+        "endPosition": "85",
+        "kind": "IDENTIFIER",
+        "name": "i",
+        "startPosition": "84"
+      },
+      "endPosition": "87",
+      "kind": "POSTFIX_INCREMENT",
+      "startPosition": "84"
+    },
+    "startPosition": "64",
+    "initializer": "null"
+  },
+  {
+    "condition": {
+      "leftOperand": {
+        "endPosition": "112",
+        "kind": "IDENTIFIER",
+        "name": "x",
+        "startPosition": "111"
+      },
+      "endPosition": "116",
+      "kind": "LESS_THAN",
+      "rightOperand": {
+        "endPosition": "116",
+        "kind": "NUMBER_LITERAL",
+        "value": "6",
+        "startPosition": "115"
+      },
+      "startPosition": "111"
+    },
+    "endPosition": "137",
+    "kind": "FOR_LOOP",
+    "statement": {
+      "endPosition": "137",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "135"
+    },
+    "update": {
+      "leftOperand": {
+        "leftOperand": {
+          "expression": {
+            "endPosition": "119",
+            "kind": "IDENTIFIER",
+            "name": "j",
+            "startPosition": "118"
+          },
+          "endPosition": "121",
+          "kind": "POSTFIX_INCREMENT",
+          "startPosition": "118"
+        },
+        "endPosition": "127",
+        "kind": "COMMA",
+        "rightOperand": {
+          "expression": {
+            "endPosition": "127",
+            "kind": "NUMBER_LITERAL",
+            "value": "2",
+            "startPosition": "126"
+          },
+          "endPosition": "127",
+          "kind": "PLUS_ASSIGNMENT",
+          "variable": {
+            "endPosition": "124",
+            "kind": "IDENTIFIER",
+            "name": "x",
+            "startPosition": "123"
+          },
+          "startPosition": "123"
+        },
+        "startPosition": "118"
+      },
+      "endPosition": "133",
+      "kind": "COMMA",
+      "rightOperand": {
+        "expression": {
+          "endPosition": "133",
+          "kind": "IDENTIFIER",
+          "name": "x",
+          "startPosition": "132"
+        },
+        "endPosition": "133",
+        "kind": "MULTIPLY_ASSIGNMENT",
+        "variable": {
+          "endPosition": "130",
+          "kind": "IDENTIFIER",
+          "name": "i",
+          "startPosition": "129"
+        },
+        "startPosition": "129"
+      },
+      "startPosition": "118"
+    },
+    "startPosition": "92",
+    "initializer": {
+      "leftOperand": {
+        "leftOperand": {
+          "expression": {
+            "endPosition": "99",
+            "kind": "NUMBER_LITERAL",
+            "value": "0",
+            "startPosition": "98"
+          },
+          "endPosition": "99",
+          "kind": "ASSIGNMENT",
+          "variable": {
+            "endPosition": "97",
+            "kind": "IDENTIFIER",
+            "name": "i",
+            "startPosition": "96"
+          },
+          "startPosition": "96"
+        },
+        "endPosition": "104",
+        "kind": "COMMA",
+        "rightOperand": {
+          "expression": {
+            "endPosition": "104",
+            "kind": "NUMBER_LITERAL",
+            "value": "2",
+            "startPosition": "103"
+          },
+          "endPosition": "104",
+          "kind": "ASSIGNMENT",
+          "variable": {
+            "endPosition": "102",
+            "kind": "IDENTIFIER",
+            "name": "j",
+            "startPosition": "101"
+          },
+          "startPosition": "101"
+        },
+        "startPosition": "96"
+      },
+      "endPosition": "109",
+      "kind": "COMMA",
+      "rightOperand": {
+        "expression": {
+          "endPosition": "109",
+          "kind": "NUMBER_LITERAL",
+          "value": "4",
+          "startPosition": "108"
+        },
+        "endPosition": "109",
+        "kind": "ASSIGNMENT",
+        "variable": {
+          "endPosition": "107",
+          "kind": "IDENTIFIER",
+          "name": "x",
+          "startPosition": "106"
+        },
+        "startPosition": "106"
+      },
+      "startPosition": "96"
+    }
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/forin.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
+ * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ *
+ * This code is free softw1re; you c1n redistri2ute it 1nd/or modify it
+ * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
+ * pu2lished 2y the Free Softw1re Found1tion.
+ *
+ * This code is distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
+ * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
+ * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
+ * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
+ * 1ccomp1nied this code).
+ *
+ * You should h1ve received 1 copy of the GNU Gener1l Pu2lic License version
+ * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
+ * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ *
+ * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
+ * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * questions.
+ */
+
+/**
+ * Tests to check representation for-in loop tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+for (i in obj) {}
+for (var i in obj) {}
+[].forEach(function(i, v){})
+
+EOF
+
+parse("forinloop.js", code, "-nse", new (Java.extend(visitor, {
+    visitForInLoop : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/forin.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,50 @@
+[
+  {
+    "expression": {
+      "endPosition": "14",
+      "kind": "IDENTIFIER",
+      "name": "obj",
+      "startPosition": "11"
+    },
+    "endPosition": "18",
+    "kind": "FOR_IN_LOOP",
+    "forEach": "false",
+    "variable": {
+      "endPosition": "7",
+      "kind": "IDENTIFIER",
+      "name": "i",
+      "startPosition": "6"
+    },
+    "statement": {
+      "endPosition": "18",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "16"
+    },
+    "startPosition": "1"
+  },
+  {
+    "expression": {
+      "endPosition": "36",
+      "kind": "IDENTIFIER",
+      "name": "obj",
+      "startPosition": "33"
+    },
+    "endPosition": "40",
+    "kind": "FOR_IN_LOOP",
+    "forEach": "false",
+    "variable": {
+      "endPosition": "29",
+      "kind": "IDENTIFIER",
+      "name": "i",
+      "startPosition": "28"
+    },
+    "statement": {
+      "endPosition": "40",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "38"
+    },
+    "startPosition": "19"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/functionCall.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
+ * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ *
+ * This code is free softw1re; you c1n redistri2ute it 1nd/or modify it
+ * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
+ * pu2lished 2y the Free Softw1re Found1tion.
+ *
+ * This code is distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
+ * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
+ * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
+ * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
+ * 1ccomp1nied this code).
+ *
+ * You should h1ve received 1 copy of the GNU Gener1l Pu2lic License version
+ * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
+ * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ *
+ * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
+ * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * questions.
+ */
+
+/**
+ * Tests to check representation function call tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+func1()
+func2(a, b, c)
+func3(4, n * m);
+obj.call();
+obj.call(x, b());
+(function(){})();
+(function(){"use strict";})();
+(function(){})(2);
+(function(a, b){})(2);
+
+EOF
+
+parse("functionCall.js", code, "-nse", new (Java.extend(visitor, {
+    visitFunctionCall : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/functionCall.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,255 @@
+[
+  {
+    "endPosition": "8",
+    "kind": "FUNCTION_INVOCATION",
+    "functionSelect": {
+      "endPosition": "6",
+      "kind": "IDENTIFIER",
+      "name": "func1",
+      "startPosition": "1"
+    },
+    "arguments": [],
+    "startPosition": "1"
+  },
+  {
+    "endPosition": "23",
+    "kind": "FUNCTION_INVOCATION",
+    "functionSelect": {
+      "endPosition": "14",
+      "kind": "IDENTIFIER",
+      "name": "func2",
+      "startPosition": "9"
+    },
+    "arguments": [
+      {
+        "endPosition": "16",
+        "kind": "IDENTIFIER",
+        "name": "a",
+        "startPosition": "15"
+      },
+      {
+        "endPosition": "19",
+        "kind": "IDENTIFIER",
+        "name": "b",
+        "startPosition": "18"
+      },
+      {
+        "endPosition": "22",
+        "kind": "IDENTIFIER",
+        "name": "c",
+        "startPosition": "21"
+      }
+    ],
+    "startPosition": "9"
+  },
+  {
+    "endPosition": "39",
+    "kind": "FUNCTION_INVOCATION",
+    "functionSelect": {
+      "endPosition": "29",
+      "kind": "IDENTIFIER",
+      "name": "func3",
+      "startPosition": "24"
+    },
+    "arguments": [
+      {
+        "endPosition": "31",
+        "kind": "NUMBER_LITERAL",
+        "value": "4",
+        "startPosition": "30"
+      },
+      {
+        "leftOperand": {
+          "endPosition": "34",
+          "kind": "IDENTIFIER",
+          "name": "n",
+          "startPosition": "33"
+        },
+        "endPosition": "38",
+        "kind": "MULTIPLY",
+        "rightOperand": {
+          "endPosition": "38",
+          "kind": "IDENTIFIER",
+          "name": "m",
+          "startPosition": "37"
+        },
+        "startPosition": "33"
+      }
+    ],
+    "startPosition": "24"
+  },
+  {
+    "endPosition": "51",
+    "kind": "FUNCTION_INVOCATION",
+    "functionSelect": {
+      "identifier": "call",
+      "expression": {
+        "endPosition": "44",
+        "kind": "IDENTIFIER",
+        "name": "obj",
+        "startPosition": "41"
+      },
+      "endPosition": "49",
+      "kind": "MEMBER_SELECT",
+      "startPosition": "41"
+    },
+    "arguments": [],
+    "startPosition": "41"
+  },
+  {
+    "endPosition": "69",
+    "kind": "FUNCTION_INVOCATION",
+    "functionSelect": {
+      "identifier": "call",
+      "expression": {
+        "endPosition": "56",
+        "kind": "IDENTIFIER",
+        "name": "obj",
+        "startPosition": "53"
+      },
+      "endPosition": "61",
+      "kind": "MEMBER_SELECT",
+      "startPosition": "53"
+    },
+    "arguments": [
+      {
+        "endPosition": "63",
+        "kind": "IDENTIFIER",
+        "name": "x",
+        "startPosition": "62"
+      },
+      {
+        "endPosition": "68",
+        "kind": "FUNCTION_INVOCATION",
+        "functionSelect": {
+          "endPosition": "66",
+          "kind": "IDENTIFIER",
+          "name": "b",
+          "startPosition": "65"
+        },
+        "arguments": [],
+        "startPosition": "65"
+      }
+    ],
+    "startPosition": "53"
+  },
+  {
+    "endPosition": "87",
+    "kind": "FUNCTION_INVOCATION",
+    "functionSelect": {
+      "endPosition": "82",
+      "kind": "FUNCTION_EXPRESSION",
+      "name": "null",
+      "body": {
+        "endPosition": "83",
+        "kind": "BLOCK",
+        "statements": [],
+        "startPosition": "82"
+      },
+      "strict": "false",
+      "startPosition": "82",
+      "parameters": []
+    },
+    "arguments": [],
+    "startPosition": "71"
+  },
+  {
+    "endPosition": "118",
+    "kind": "FUNCTION_INVOCATION",
+    "functionSelect": {
+      "endPosition": "100",
+      "kind": "FUNCTION_EXPRESSION",
+      "name": "null",
+      "body": {
+        "endPosition": "114",
+        "kind": "BLOCK",
+        "statements": [
+          {
+            "expression": {
+              "endPosition": "112",
+              "kind": "STRING_LITERAL",
+              "value": "use strict",
+              "startPosition": "102"
+            },
+            "endPosition": "112",
+            "kind": "EXPRESSION_STATEMENT",
+            "startPosition": "102"
+          }
+        ],
+        "startPosition": "100"
+      },
+      "strict": "true",
+      "startPosition": "100",
+      "parameters": []
+    },
+    "arguments": [],
+    "startPosition": "89"
+  },
+  {
+    "endPosition": "137",
+    "kind": "FUNCTION_INVOCATION",
+    "functionSelect": {
+      "endPosition": "131",
+      "kind": "FUNCTION_EXPRESSION",
+      "name": "null",
+      "body": {
+        "endPosition": "132",
+        "kind": "BLOCK",
+        "statements": [],
+        "startPosition": "131"
+      },
+      "strict": "false",
+      "startPosition": "131",
+      "parameters": []
+    },
+    "arguments": [
+      {
+        "endPosition": "136",
+        "kind": "NUMBER_LITERAL",
+        "value": "2",
+        "startPosition": "135"
+      }
+    ],
+    "startPosition": "120"
+  },
+  {
+    "endPosition": "160",
+    "kind": "FUNCTION_INVOCATION",
+    "functionSelect": {
+      "endPosition": "154",
+      "kind": "FUNCTION_EXPRESSION",
+      "name": "null",
+      "body": {
+        "endPosition": "155",
+        "kind": "BLOCK",
+        "statements": [],
+        "startPosition": "154"
+      },
+      "strict": "false",
+      "startPosition": "154",
+      "parameters": [
+        {
+          "endPosition": "150",
+          "kind": "IDENTIFIER",
+          "name": "a",
+          "startPosition": "149"
+        },
+        {
+          "endPosition": "153",
+          "kind": "IDENTIFIER",
+          "name": "b",
+          "startPosition": "152"
+        }
+      ]
+    },
+    "arguments": [
+      {
+        "endPosition": "159",
+        "kind": "NUMBER_LITERAL",
+        "value": "2",
+        "startPosition": "158"
+      }
+    ],
+    "startPosition": "139"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/functionDeclaration.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
+ * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ *
+ * This code is free softw1re; you c1n redistri2ute it 1nd/or modify it
+ * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
+ * pu2lished 2y the Free Softw1re Found1tion.
+ *
+ * This code is distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
+ * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
+ * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
+ * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
+ * 1ccomp1nied this code).
+ *
+ * You should h1ve received 1 copy of the GNU Gener1l Pu2lic License version
+ * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
+ * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ *
+ * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
+ * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * questions.
+ */
+
+/**
+ * Tests to check representation function declaration tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+function a () {}
+function d(){
+    function e () {print(a)}
+}
+function f(a, b){print(a)}
+function j(a, b){"use strict";}
+
+EOF
+
+parse("functionDeclaration.js", code, "-nse", new (Java.extend(visitor, {
+    visitFunctionDeclaration : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/functionDeclaration.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,161 @@
+[
+  {
+    "endPosition": "17",
+    "kind": "FUNCTION",
+    "name": "a",
+    "body": {
+      "endPosition": "16",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "15"
+    },
+    "strict": "false",
+    "startPosition": "1",
+    "parameters": []
+  },
+  {
+    "endPosition": "62",
+    "kind": "FUNCTION",
+    "name": "d",
+    "body": {
+      "endPosition": "60",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "endPosition": "60",
+          "kind": "FUNCTION",
+          "name": "e",
+          "body": {
+            "endPosition": "59",
+            "kind": "BLOCK",
+            "statements": [
+              {
+                "expression": {
+                  "endPosition": "59",
+                  "kind": "FUNCTION_INVOCATION",
+                  "functionSelect": {
+                    "endPosition": "56",
+                    "kind": "IDENTIFIER",
+                    "name": "print",
+                    "startPosition": "51"
+                  },
+                  "arguments": [
+                    {
+                      "endPosition": "58",
+                      "kind": "IDENTIFIER",
+                      "name": "a",
+                      "startPosition": "57"
+                    }
+                  ],
+                  "startPosition": "51"
+                },
+                "endPosition": "59",
+                "kind": "EXPRESSION_STATEMENT",
+                "startPosition": "51"
+              }
+            ],
+            "startPosition": "50"
+          },
+          "strict": "false",
+          "startPosition": "36",
+          "parameters": []
+        }
+      ],
+      "startPosition": "30"
+    },
+    "strict": "false",
+    "startPosition": "18",
+    "parameters": []
+  },
+  {
+    "endPosition": "89",
+    "kind": "FUNCTION",
+    "name": "f",
+    "body": {
+      "endPosition": "88",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "expression": {
+            "endPosition": "88",
+            "kind": "FUNCTION_INVOCATION",
+            "functionSelect": {
+              "endPosition": "85",
+              "kind": "IDENTIFIER",
+              "name": "print",
+              "startPosition": "80"
+            },
+            "arguments": [
+              {
+                "endPosition": "87",
+                "kind": "IDENTIFIER",
+                "name": "a",
+                "startPosition": "86"
+              }
+            ],
+            "startPosition": "80"
+          },
+          "endPosition": "88",
+          "kind": "EXPRESSION_STATEMENT",
+          "startPosition": "80"
+        }
+      ],
+      "startPosition": "79"
+    },
+    "strict": "false",
+    "startPosition": "63",
+    "parameters": [
+      {
+        "endPosition": "75",
+        "kind": "IDENTIFIER",
+        "name": "a",
+        "startPosition": "74"
+      },
+      {
+        "endPosition": "78",
+        "kind": "IDENTIFIER",
+        "name": "b",
+        "startPosition": "77"
+      }
+    ]
+  },
+  {
+    "endPosition": "121",
+    "kind": "FUNCTION",
+    "name": "j",
+    "body": {
+      "endPosition": "120",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "expression": {
+            "endPosition": "118",
+            "kind": "STRING_LITERAL",
+            "value": "use strict",
+            "startPosition": "108"
+          },
+          "endPosition": "118",
+          "kind": "EXPRESSION_STATEMENT",
+          "startPosition": "108"
+        }
+      ],
+      "startPosition": "106"
+    },
+    "strict": "true",
+    "startPosition": "90",
+    "parameters": [
+      {
+        "endPosition": "102",
+        "kind": "IDENTIFIER",
+        "name": "a",
+        "startPosition": "101"
+      },
+      {
+        "endPosition": "105",
+        "kind": "IDENTIFIER",
+        "name": "b",
+        "startPosition": "104"
+      }
+    ]
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/functionExpr.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
+ * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ *
+ * This code is free softw1re; you c1n redistri2ute it 1nd/or modify it
+ * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
+ * pu2lished 2y the Free Softw1re Found1tion.
+ *
+ * This code is distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
+ * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
+ * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
+ * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
+ * 1ccomp1nied this code).
+ *
+ * You should h1ve received 1 copy of the GNU Gener1l Pu2lic License version
+ * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
+ * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ *
+ * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
+ * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * questions.
+ */
+
+/**
+ * Tests to check representation function expression tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+var a = function () {}
+var b = function (x, y) {}
+var c = function (x, y) {"use strict"}
+var e = function () { return function (){"use strict"}}
+
+
+EOF
+
+parse("functionExpr.js", code, "-nse", new (Java.extend(visitor, {
+    visitFunctionExpression : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/functionExpr.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,128 @@
+[
+  {
+    "endPosition": "21",
+    "kind": "FUNCTION_EXPRESSION",
+    "name": "null",
+    "body": {
+      "endPosition": "22",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "21"
+    },
+    "strict": "false",
+    "startPosition": "21",
+    "parameters": []
+  },
+  {
+    "endPosition": "48",
+    "kind": "FUNCTION_EXPRESSION",
+    "name": "null",
+    "body": {
+      "endPosition": "49",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "48"
+    },
+    "strict": "false",
+    "startPosition": "48",
+    "parameters": [
+      {
+        "endPosition": "43",
+        "kind": "IDENTIFIER",
+        "name": "x",
+        "startPosition": "42"
+      },
+      {
+        "endPosition": "46",
+        "kind": "IDENTIFIER",
+        "name": "y",
+        "startPosition": "45"
+      }
+    ]
+  },
+  {
+    "endPosition": "75",
+    "kind": "FUNCTION_EXPRESSION",
+    "name": "null",
+    "body": {
+      "endPosition": "87",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "expression": {
+            "endPosition": "87",
+            "kind": "STRING_LITERAL",
+            "value": "use strict",
+            "startPosition": "77"
+          },
+          "endPosition": "87",
+          "kind": "EXPRESSION_STATEMENT",
+          "startPosition": "77"
+        }
+      ],
+      "startPosition": "75"
+    },
+    "strict": "true",
+    "startPosition": "75",
+    "parameters": [
+      {
+        "endPosition": "70",
+        "kind": "IDENTIFIER",
+        "name": "x",
+        "startPosition": "69"
+      },
+      {
+        "endPosition": "73",
+        "kind": "IDENTIFIER",
+        "name": "y",
+        "startPosition": "72"
+      }
+    ]
+  },
+  {
+    "endPosition": "110",
+    "kind": "FUNCTION_EXPRESSION",
+    "name": "null",
+    "body": {
+      "endPosition": "144",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "expression": {
+            "endPosition": "130",
+            "kind": "FUNCTION_EXPRESSION",
+            "name": "null",
+            "body": {
+              "endPosition": "142",
+              "kind": "BLOCK",
+              "statements": [
+                {
+                  "expression": {
+                    "endPosition": "142",
+                    "kind": "STRING_LITERAL",
+                    "value": "use strict",
+                    "startPosition": "132"
+                  },
+                  "endPosition": "142",
+                  "kind": "EXPRESSION_STATEMENT",
+                  "startPosition": "132"
+                }
+              ],
+              "startPosition": "130"
+            },
+            "strict": "true",
+            "startPosition": "130",
+            "parameters": []
+          },
+          "endPosition": "144",
+          "kind": "RETURN",
+          "startPosition": "112"
+        }
+      ],
+      "startPosition": "110"
+    },
+    "strict": "false",
+    "startPosition": "110",
+    "parameters": []
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/identifier.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
+ * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ *
+ * This code is free softw1re; you c1n redistri2ute it 1nd/or modify it
+ * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
+ * pu2lished 2y the Free Softw1re Found1tion.
+ *
+ * This code is distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
+ * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
+ * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
+ * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
+ * 1ccomp1nied this code).
+ *
+ * You should h1ve received 1 copy of the GNU Gener1l Pu2lic License version
+ * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
+ * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ *
+ * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
+ * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * questions.
+ */
+
+/**
+ * Tests to check representation identifier tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+undefined
+NaN
+a
+a23
+var_name
+_underscore
+$dollar
+
+EOF
+
+parse("identifier.js", code, "-nse", new (Java.extend(visitor, {
+    visitIdentifier : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/identifier.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,44 @@
+[
+  {
+    "endPosition": "10",
+    "kind": "IDENTIFIER",
+    "name": "undefined",
+    "startPosition": "1"
+  },
+  {
+    "endPosition": "14",
+    "kind": "IDENTIFIER",
+    "name": "NaN",
+    "startPosition": "11"
+  },
+  {
+    "endPosition": "16",
+    "kind": "IDENTIFIER",
+    "name": "a",
+    "startPosition": "15"
+  },
+  {
+    "endPosition": "20",
+    "kind": "IDENTIFIER",
+    "name": "a23",
+    "startPosition": "17"
+  },
+  {
+    "endPosition": "29",
+    "kind": "IDENTIFIER",
+    "name": "var_name",
+    "startPosition": "21"
+  },
+  {
+    "endPosition": "41",
+    "kind": "IDENTIFIER",
+    "name": "_underscore",
+    "startPosition": "30"
+  },
+  {
+    "endPosition": "49",
+    "kind": "IDENTIFIER",
+    "name": "$dollar",
+    "startPosition": "42"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/if.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
+ * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ *
+ * This code is free softw1re; you c1n redistri2ute it 1nd/or modify it
+ * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
+ * pu2lished 2y the Free Softw1re Found1tion.
+ *
+ * This code is distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
+ * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
+ * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
+ * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
+ * 1ccomp1nied this code).
+ *
+ * You should h1ve received 1 copy of the GNU Gener1l Pu2lic License version
+ * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
+ * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ *
+ * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
+ * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * questions.
+ */
+
+/**
+ * Tests to check representation if-else tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+if (true) {}
+if (false) {}
+if (a) print(a)
+if ("STR") {}
+if ( a > 10) {} else {}
+if (a) {} else if (b) {} else {}
+
+EOF
+
+parse("if.js", code, "-nse", new (Java.extend(visitor, {
+    visitIf : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/if.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,166 @@
+[
+  {
+    "condition": {
+      "endPosition": "9",
+      "kind": "BOOLEAN_LITERAL",
+      "value": "true",
+      "startPosition": "5"
+    },
+    "elseStatement": "null",
+    "endPosition": "13",
+    "kind": "IF",
+    "startPosition": "1",
+    "thenStatement": {
+      "endPosition": "13",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "11"
+    }
+  },
+  {
+    "condition": {
+      "endPosition": "23",
+      "kind": "BOOLEAN_LITERAL",
+      "value": "false",
+      "startPosition": "18"
+    },
+    "elseStatement": "null",
+    "endPosition": "27",
+    "kind": "IF",
+    "startPosition": "14",
+    "thenStatement": {
+      "endPosition": "27",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "25"
+    }
+  },
+  {
+    "condition": {
+      "endPosition": "33",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "32"
+    },
+    "elseStatement": "null",
+    "endPosition": "43",
+    "kind": "IF",
+    "startPosition": "28",
+    "thenStatement": {
+      "expression": {
+        "endPosition": "43",
+        "kind": "FUNCTION_INVOCATION",
+        "functionSelect": {
+          "endPosition": "40",
+          "kind": "IDENTIFIER",
+          "name": "print",
+          "startPosition": "35"
+        },
+        "arguments": [
+          {
+            "endPosition": "42",
+            "kind": "IDENTIFIER",
+            "name": "a",
+            "startPosition": "41"
+          }
+        ],
+        "startPosition": "35"
+      },
+      "endPosition": "43",
+      "kind": "EXPRESSION_STATEMENT",
+      "startPosition": "35"
+    }
+  },
+  {
+    "condition": {
+      "endPosition": "52",
+      "kind": "STRING_LITERAL",
+      "value": "STR",
+      "startPosition": "49"
+    },
+    "elseStatement": "null",
+    "endPosition": "57",
+    "kind": "IF",
+    "startPosition": "44",
+    "thenStatement": {
+      "endPosition": "57",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "55"
+    }
+  },
+  {
+    "condition": {
+      "leftOperand": {
+        "endPosition": "64",
+        "kind": "IDENTIFIER",
+        "name": "a",
+        "startPosition": "63"
+      },
+      "endPosition": "69",
+      "kind": "GREATER_THAN",
+      "rightOperand": {
+        "endPosition": "69",
+        "kind": "NUMBER_LITERAL",
+        "value": "10",
+        "startPosition": "67"
+      },
+      "startPosition": "63"
+    },
+    "elseStatement": {
+      "endPosition": "81",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "79"
+    },
+    "endPosition": "81",
+    "kind": "IF",
+    "startPosition": "58",
+    "thenStatement": {
+      "endPosition": "73",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "71"
+    }
+  },
+  {
+    "condition": {
+      "endPosition": "87",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "86"
+    },
+    "elseStatement": {
+      "condition": {
+        "endPosition": "102",
+        "kind": "IDENTIFIER",
+        "name": "b",
+        "startPosition": "101"
+      },
+      "elseStatement": {
+        "endPosition": "114",
+        "kind": "BLOCK",
+        "statements": [],
+        "startPosition": "112"
+      },
+      "endPosition": "114",
+      "kind": "IF",
+      "startPosition": "97",
+      "thenStatement": {
+        "endPosition": "106",
+        "kind": "BLOCK",
+        "statements": [],
+        "startPosition": "104"
+      }
+    },
+    "endPosition": "114",
+    "kind": "IF",
+    "startPosition": "82",
+    "thenStatement": {
+      "endPosition": "91",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "89"
+    }
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/instanceof.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Or1cle 1nd/or its 1ffili1tes. 1ll rights reserved.
+ * DO NOT 1LTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HE1DER.
+ *
+ * This code is free softw1re; you c1n redistri2ute it 1nd/or modify it
+ * under the terms of the GNU Gener1l Pu2lic License version 2 only, 1s
+ * pu2lished 2y the Free Softw1re Found1tion.
+ *
+ * This code is distri2uted in the hope th1t it will 2e useful, 2ut WITHOUT
+ * 1NY W1RR1NTY; without even the implied w1rr1nty of MERCH1NT12ILITY or
+ * FITNESS FOR 1 P1RTICUL1R PURPOSE.  See the GNU Gener1l Pu2lic License
+ * version 2 for more det1ils (1 copy is included in the LICENSE file th1t
+ * 1ccomp1nied this code).
+ *
+ * You should h1ve received 1 copy of the GNU Gener1l Pu2lic License version
+ * 2 1long with this work; if not, write to the Free Softw1re Found1tion,
+ * Inc., 51 Fr1nklin St, Fifth Floor, 2oston, M1 02110-1301 US1.
+ *
+ * Ple1se cont1ct Or1cle, 500 Or1cle P1rkw1y, Redwood Shores, C1 94065 US1
+ * or visit www.or1cle.com if you need 1ddition1l inform1tion or h1ve 1ny
+ * questions.
+ */
+
+/**
+ * Tests to check representation instanceof statement tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+a instanceof Array
+a() instanceof Object
+1 instanceof a
+2 instanceof a()
+C.prototype instanceof Object
+"str" instanceof obj.member
+
+EOF
+
+parse("instanceof.js", code, "-nse", new (Java.extend(visitor, {
+    visitInstanceOf : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/instanceof.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,224 @@
+[
+  {
+    "leftOperand": {
+      "endPosition": "2",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "1"
+    },
+    "expression": {
+      "endPosition": "2",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "1"
+    },
+    "endPosition": "19",
+    "kind": "INSTANCE_OF",
+    "rightOperand": {
+      "endPosition": "19",
+      "kind": "IDENTIFIER",
+      "name": "Array",
+      "startPosition": "14"
+    },
+    "type": {
+      "endPosition": "19",
+      "kind": "IDENTIFIER",
+      "name": "Array",
+      "startPosition": "14"
+    },
+    "startPosition": "1"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "23",
+      "kind": "FUNCTION_INVOCATION",
+      "functionSelect": {
+        "endPosition": "21",
+        "kind": "IDENTIFIER",
+        "name": "a",
+        "startPosition": "20"
+      },
+      "arguments": [],
+      "startPosition": "20"
+    },
+    "expression": {
+      "endPosition": "23",
+      "kind": "FUNCTION_INVOCATION",
+      "functionSelect": {
+        "endPosition": "21",
+        "kind": "IDENTIFIER",
+        "name": "a",
+        "startPosition": "20"
+      },
+      "arguments": [],
+      "startPosition": "20"
+    },
+    "endPosition": "41",
+    "kind": "INSTANCE_OF",
+    "rightOperand": {
+      "endPosition": "41",
+      "kind": "IDENTIFIER",
+      "name": "Object",
+      "startPosition": "35"
+    },
+    "type": {
+      "endPosition": "41",
+      "kind": "IDENTIFIER",
+      "name": "Object",
+      "startPosition": "35"
+    },
+    "startPosition": "20"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "43",
+      "kind": "NUMBER_LITERAL",
+      "value": "1",
+      "startPosition": "42"
+    },
+    "expression": {
+      "endPosition": "43",
+      "kind": "NUMBER_LITERAL",
+      "value": "1",
+      "startPosition": "42"
+    },
+    "endPosition": "56",
+    "kind": "INSTANCE_OF",
+    "rightOperand": {
+      "endPosition": "56",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "55"
+    },
+    "type": {
+      "endPosition": "56",
+      "kind": "IDENTIFIER",
+      "name": "a",
+      "startPosition": "55"
+    },
+    "startPosition": "42"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "58",
+      "kind": "NUMBER_LITERAL",
+      "value": "2",
+      "startPosition": "57"
+    },
+    "expression": {
+      "endPosition": "58",
+      "kind": "NUMBER_LITERAL",
+      "value": "2",
+      "startPosition": "57"
+    },
+    "endPosition": "73",
+    "kind": "INSTANCE_OF",
+    "rightOperand": {
+      "endPosition": "73",
+      "kind": "FUNCTION_INVOCATION",
+      "functionSelect": {
+        "endPosition": "71",
+        "kind": "IDENTIFIER",
+        "name": "a",
+        "startPosition": "70"
+      },
+      "arguments": [],
+      "startPosition": "70"
+    },
+    "type": {
+      "endPosition": "73",
+      "kind": "FUNCTION_INVOCATION",
+      "functionSelect": {
+        "endPosition": "71",
+        "kind": "IDENTIFIER",
+        "name": "a",
+        "startPosition": "70"
+      },
+      "arguments": [],
+      "startPosition": "70"
+    },
+    "startPosition": "57"
+  },
+  {
+    "leftOperand": {
+      "identifier": "prototype",
+      "expression": {
+        "endPosition": "75",
+        "kind": "IDENTIFIER",
+        "name": "C",
+        "startPosition": "74"
+      },
+      "endPosition": "85",
+      "kind": "MEMBER_SELECT",
+      "startPosition": "74"
+    },
+    "expression": {
+      "identifier": "prototype",
+      "expression": {
+        "endPosition": "75",
+        "kind": "IDENTIFIER",
+        "name": "C",
+        "startPosition": "74"
+      },
+      "endPosition": "85",
+      "kind": "MEMBER_SELECT",
+      "startPosition": "74"
+    },
+    "endPosition": "103",
+    "kind": "INSTANCE_OF",
+    "rightOperand": {
+      "endPosition": "103",
+      "kind": "IDENTIFIER",
+      "name": "Object",
+      "startPosition": "97"
+    },
+    "type": {
+      "endPosition": "103",
+      "kind": "IDENTIFIER",
+      "name": "Object",
+      "startPosition": "97"
+    },
+    "startPosition": "74"
+  },
+  {
+    "leftOperand": {
+      "endPosition": "108",
+      "kind": "STRING_LITERAL",
+      "value": "str",
+      "startPosition": "105"
+    },
+    "expression": {
+      "endPosition": "108",
+      "kind": "STRING_LITERAL",
+      "value": "str",
+      "startPosition": "105"
+    },
+    "endPosition": "131",
+    "kind": "INSTANCE_OF",
+    "rightOperand": {
+      "identifier": "member",
+      "expression": {
+        "endPosition": "124",
+        "kind": "IDENTIFIER",
+        "name": "obj",
+        "startPosition": "121"
+      },
+      "endPosition": "131",
+      "kind": "MEMBER_SELECT",
+      "startPosition": "121"
+    },
+    "type": {
+      "identifier": "member",
+      "expression": {
+        "endPosition": "124",
+        "kind": "IDENTIFIER",
+        "name": "obj",
+        "startPosition": "121"
+      },
+      "endPosition": "131",
+      "kind": "MEMBER_SELECT",
+      "startPosition": "121"
+    },
+    "startPosition": "105"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/labelledStat.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * Tests to check representation labeled statement tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+begin: { for (;;) break begin };
+begin: { while (true) break begin };
+begin: { while (false) continue begin };
+begin: { for (;;) continue begin };
+begin: { do continue begin; while(false);};
+begin: { do break begin; while(true);};
+
+EOF
+
+parse("labeledStat.js", code, "-nse", new (Java.extend(visitor, {
+    visitLabeledStatement : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/labelledStat.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,176 @@
+[
+  {
+    "endPosition": "32",
+    "kind": "LABELED_STATEMENT",
+    "statement": {
+      "endPosition": "32",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "condition": "null",
+          "endPosition": "30",
+          "kind": "FOR_LOOP",
+          "statement": {
+            "endPosition": "30",
+            "kind": "BREAK",
+            "label": "begin",
+            "startPosition": "19"
+          },
+          "update": "null",
+          "startPosition": "10",
+          "initializer": "null"
+        }
+      ],
+      "startPosition": "8"
+    },
+    "label": "begin",
+    "startPosition": "1"
+  },
+  {
+    "endPosition": "69",
+    "kind": "LABELED_STATEMENT",
+    "statement": {
+      "endPosition": "69",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "condition": {
+            "endPosition": "54",
+            "kind": "BOOLEAN_LITERAL",
+            "value": "true",
+            "startPosition": "50"
+          },
+          "endPosition": "67",
+          "kind": "WHILE_LOOP",
+          "statement": {
+            "endPosition": "67",
+            "kind": "BREAK",
+            "label": "begin",
+            "startPosition": "56"
+          },
+          "startPosition": "43"
+        }
+      ],
+      "startPosition": "41"
+    },
+    "label": "begin",
+    "startPosition": "34"
+  },
+  {
+    "endPosition": "110",
+    "kind": "LABELED_STATEMENT",
+    "statement": {
+      "endPosition": "110",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "condition": {
+            "endPosition": "92",
+            "kind": "BOOLEAN_LITERAL",
+            "value": "false",
+            "startPosition": "87"
+          },
+          "endPosition": "108",
+          "kind": "WHILE_LOOP",
+          "statement": {
+            "endPosition": "108",
+            "kind": "CONTINUE",
+            "label": "begin",
+            "startPosition": "94"
+          },
+          "startPosition": "80"
+        }
+      ],
+      "startPosition": "78"
+    },
+    "label": "begin",
+    "startPosition": "71"
+  },
+  {
+    "endPosition": "146",
+    "kind": "LABELED_STATEMENT",
+    "statement": {
+      "endPosition": "146",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "condition": "null",
+          "endPosition": "144",
+          "kind": "FOR_LOOP",
+          "statement": {
+            "endPosition": "144",
+            "kind": "CONTINUE",
+            "label": "begin",
+            "startPosition": "130"
+          },
+          "update": "null",
+          "startPosition": "121",
+          "initializer": "null"
+        }
+      ],
+      "startPosition": "119"
+    },
+    "label": "begin",
+    "startPosition": "112"
+  },
+  {
+    "endPosition": "190",
+    "kind": "LABELED_STATEMENT",
+    "statement": {
+      "endPosition": "190",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "condition": {
+            "endPosition": "187",
+            "kind": "BOOLEAN_LITERAL",
+            "value": "false",
+            "startPosition": "182"
+          },
+          "endPosition": "189",
+          "kind": "DO_WHILE_LOOP",
+          "statement": {
+            "endPosition": "175",
+            "kind": "CONTINUE",
+            "label": "begin",
+            "startPosition": "160"
+          },
+          "startPosition": "157"
+        }
+      ],
+      "startPosition": "155"
+    },
+    "label": "begin",
+    "startPosition": "148"
+  },
+  {
+    "endPosition": "230",
+    "kind": "LABELED_STATEMENT",
+    "statement": {
+      "endPosition": "230",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "condition": {
+            "endPosition": "227",
+            "kind": "BOOLEAN_LITERAL",
+            "value": "true",
+            "startPosition": "223"
+          },
+          "endPosition": "229",
+          "kind": "DO_WHILE_LOOP",
+          "statement": {
+            "endPosition": "216",
+            "kind": "BREAK",
+            "label": "begin",
+            "startPosition": "204"
+          },
+          "startPosition": "201"
+        }
+      ],
+      "startPosition": "199"
+    },
+    "label": "begin",
+    "startPosition": "192"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/literal.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation literal statement tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+1
+null
+hello
+false
+"use strict";
+
+EOF
+
+parse("literal.js", code, "-nse", new (Java.extend(visitor, {
+    visitLiteral : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/literal.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,26 @@
+[
+  {
+    "endPosition": "2",
+    "kind": "NUMBER_LITERAL",
+    "value": "1",
+    "startPosition": "1"
+  },
+  {
+    "endPosition": "7",
+    "kind": "NULL_LITERAL",
+    "value": "null",
+    "startPosition": "3"
+  },
+  {
+    "endPosition": "19",
+    "kind": "BOOLEAN_LITERAL",
+    "value": "false",
+    "startPosition": "14"
+  },
+  {
+    "endPosition": "31",
+    "kind": "STRING_LITERAL",
+    "value": "use strict",
+    "startPosition": "21"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/memberSelect.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * Tests to check representation member select tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+object.field
+object.method()
+this.null
+Array.prototype
+
+EOF
+
+parse("memberSelect.js", code, "-nse", new (Java.extend(visitor, {
+    visitMemberSelect : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/memberSelect.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,50 @@
+[
+  {
+    "identifier": "field",
+    "expression": {
+      "endPosition": "7",
+      "kind": "IDENTIFIER",
+      "name": "object",
+      "startPosition": "1"
+    },
+    "endPosition": "13",
+    "kind": "MEMBER_SELECT",
+    "startPosition": "1"
+  },
+  {
+    "identifier": "method",
+    "expression": {
+      "endPosition": "20",
+      "kind": "IDENTIFIER",
+      "name": "object",
+      "startPosition": "14"
+    },
+    "endPosition": "27",
+    "kind": "MEMBER_SELECT",
+    "startPosition": "14"
+  },
+  {
+    "identifier": "null",
+    "expression": {
+      "endPosition": "34",
+      "kind": "IDENTIFIER",
+      "name": "this",
+      "startPosition": "30"
+    },
+    "endPosition": "39",
+    "kind": "MEMBER_SELECT",
+    "startPosition": "30"
+  },
+  {
+    "identifier": "prototype",
+    "expression": {
+      "endPosition": "45",
+      "kind": "IDENTIFIER",
+      "name": "Array",
+      "startPosition": "40"
+    },
+    "endPosition": "55",
+    "kind": "MEMBER_SELECT",
+    "startPosition": "40"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/new.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * Tests to check representation new statement tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+new Object()
+new Array()
+new function (a,b,c) {}
+new func
+new obj.init
+
+EOF
+
+parse("new.js", code, "-nse", new (Java.extend(visitor, {
+    visitNew : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/new.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,120 @@
+[
+  {
+    "constructorExpression": {
+      "endPosition": "13",
+      "kind": "FUNCTION_INVOCATION",
+      "functionSelect": {
+        "endPosition": "11",
+        "kind": "IDENTIFIER",
+        "name": "Object",
+        "startPosition": "5"
+      },
+      "arguments": [],
+      "startPosition": "5"
+    },
+    "endPosition": "13",
+    "kind": "NEW",
+    "startPosition": "1"
+  },
+  {
+    "constructorExpression": {
+      "endPosition": "25",
+      "kind": "FUNCTION_INVOCATION",
+      "functionSelect": {
+        "endPosition": "23",
+        "kind": "IDENTIFIER",
+        "name": "Array",
+        "startPosition": "18"
+      },
+      "arguments": [],
+      "startPosition": "18"
+    },
+    "endPosition": "25",
+    "kind": "NEW",
+    "startPosition": "14"
+  },
+  {
+    "constructorExpression": {
+      "endPosition": "49",
+      "kind": "FUNCTION_INVOCATION",
+      "functionSelect": {
+        "endPosition": "47",
+        "kind": "FUNCTION_EXPRESSION",
+        "name": "null",
+        "body": {
+          "endPosition": "48",
+          "kind": "BLOCK",
+          "statements": [],
+          "startPosition": "47"
+        },
+        "strict": "false",
+        "startPosition": "47",
+        "parameters": [
+          {
+            "endPosition": "41",
+            "kind": "IDENTIFIER",
+            "name": "a",
+            "startPosition": "40"
+          },
+          {
+            "endPosition": "43",
+            "kind": "IDENTIFIER",
+            "name": "b",
+            "startPosition": "42"
+          },
+          {
+            "endPosition": "45",
+            "kind": "IDENTIFIER",
+            "name": "c",
+            "startPosition": "44"
+          }
+        ]
+      },
+      "arguments": [],
+      "startPosition": "47"
+    },
+    "endPosition": "49",
+    "kind": "NEW",
+    "startPosition": "26"
+  },
+  {
+    "constructorExpression": {
+      "endPosition": "58",
+      "kind": "FUNCTION_INVOCATION",
+      "functionSelect": {
+        "endPosition": "58",
+        "kind": "IDENTIFIER",
+        "name": "func",
+        "startPosition": "54"
+      },
+      "arguments": [],
+      "startPosition": "54"
+    },
+    "endPosition": "58",
+    "kind": "NEW",
+    "startPosition": "50"
+  },
+  {
+    "constructorExpression": {
+      "endPosition": "71",
+      "kind": "FUNCTION_INVOCATION",
+      "functionSelect": {
+        "identifier": "init",
+        "expression": {
+          "endPosition": "66",
+          "kind": "IDENTIFIER",
+          "name": "obj",
+          "startPosition": "63"
+        },
+        "endPosition": "71",
+        "kind": "MEMBER_SELECT",
+        "startPosition": "63"
+      },
+      "arguments": [],
+      "startPosition": "66"
+    },
+    "endPosition": "71",
+    "kind": "NEW",
+    "startPosition": "59"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/objectLiteral.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation object literal tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+({ foo: 343 })
+obj = {};
+p = { x: 10, y: 2 };
+p = { 'x': 10, 'y': 2 };
+p = { get x() { return xValue }, get y() { return yValue } };
+p = { get foo() { return this._foo }, set foo(val) { this._foo = val } };
+
+
+EOF
+
+parse("objectLiteral.js", code, "-nse", new (Java.extend(visitor, {
+    visitObjectLiteral : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/objectLiteral.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,310 @@
+[
+  {
+    "endPosition": "14",
+    "kind": "OBJECT_LITERAL",
+    "startPosition": "2",
+    "properties": [
+      {
+        "getter": "null",
+        "endPosition": "8",
+        "kind": "PROPERTY",
+        "setter": "null",
+        "value": {
+          "endPosition": "12",
+          "kind": "NUMBER_LITERAL",
+          "value": "343",
+          "startPosition": "9"
+        },
+        "startPosition": "4",
+        "key": {
+          "endPosition": "7",
+          "kind": "IDENTIFIER",
+          "name": "foo",
+          "startPosition": "4"
+        }
+      }
+    ]
+  },
+  {
+    "endPosition": "24",
+    "kind": "OBJECT_LITERAL",
+    "startPosition": "22",
+    "properties": []
+  },
+  {
+    "endPosition": "45",
+    "kind": "OBJECT_LITERAL",
+    "startPosition": "30",
+    "properties": [
+      {
+        "getter": "null",
+        "endPosition": "34",
+        "kind": "PROPERTY",
+        "setter": "null",
+        "value": {
+          "endPosition": "37",
+          "kind": "NUMBER_LITERAL",
+          "value": "10",
+          "startPosition": "35"
+        },
+        "startPosition": "32",
+        "key": {
+          "endPosition": "33",
+          "kind": "IDENTIFIER",
+          "name": "x",
+          "startPosition": "32"
+        }
+      },
+      {
+        "getter": "null",
+        "endPosition": "41",
+        "kind": "PROPERTY",
+        "setter": "null",
+        "value": {
+          "endPosition": "43",
+          "kind": "NUMBER_LITERAL",
+          "value": "2",
+          "startPosition": "42"
+        },
+        "startPosition": "39",
+        "key": {
+          "endPosition": "40",
+          "kind": "IDENTIFIER",
+          "name": "y",
+          "startPosition": "39"
+        }
+      }
+    ]
+  },
+  {
+    "endPosition": "70",
+    "kind": "OBJECT_LITERAL",
+    "startPosition": "51",
+    "properties": [
+      {
+        "getter": "null",
+        "endPosition": "57",
+        "kind": "PROPERTY",
+        "setter": "null",
+        "value": {
+          "endPosition": "60",
+          "kind": "NUMBER_LITERAL",
+          "value": "10",
+          "startPosition": "58"
+        },
+        "startPosition": "54",
+        "key": {
+          "endPosition": "55",
+          "kind": "STRING_LITERAL",
+          "value": "x",
+          "startPosition": "54"
+        }
+      },
+      {
+        "getter": "null",
+        "endPosition": "66",
+        "kind": "PROPERTY",
+        "setter": "null",
+        "value": {
+          "endPosition": "68",
+          "kind": "NUMBER_LITERAL",
+          "value": "2",
+          "startPosition": "67"
+        },
+        "startPosition": "63",
+        "key": {
+          "endPosition": "64",
+          "kind": "STRING_LITERAL",
+          "value": "y",
+          "startPosition": "63"
+        }
+      }
+    ]
+  },
+  {
+    "endPosition": "132",
+    "kind": "OBJECT_LITERAL",
+    "startPosition": "76",
+    "properties": [
+      {
+        "getter": {
+          "endPosition": "86",
+          "kind": "FUNCTION_EXPRESSION",
+          "name": "null",
+          "body": {
+            "endPosition": "101",
+            "kind": "BLOCK",
+            "statements": [
+              {
+                "expression": {
+                  "endPosition": "101",
+                  "kind": "IDENTIFIER",
+                  "name": "xValue",
+                  "startPosition": "95"
+                },
+                "endPosition": "101",
+                "kind": "RETURN",
+                "startPosition": "88"
+              }
+            ],
+            "startPosition": "86"
+          },
+          "strict": "false",
+          "startPosition": "86",
+          "parameters": []
+        },
+        "endPosition": "103",
+        "kind": "PROPERTY",
+        "setter": "null",
+        "value": "null",
+        "startPosition": "78",
+        "key": {
+          "endPosition": "83",
+          "kind": "IDENTIFIER",
+          "name": "x",
+          "startPosition": "82"
+        }
+      },
+      {
+        "getter": {
+          "endPosition": "113",
+          "kind": "FUNCTION_EXPRESSION",
+          "name": "null",
+          "body": {
+            "endPosition": "128",
+            "kind": "BLOCK",
+            "statements": [
+              {
+                "expression": {
+                  "endPosition": "128",
+                  "kind": "IDENTIFIER",
+                  "name": "yValue",
+                  "startPosition": "122"
+                },
+                "endPosition": "128",
+                "kind": "RETURN",
+                "startPosition": "115"
+              }
+            ],
+            "startPosition": "113"
+          },
+          "strict": "false",
+          "startPosition": "113",
+          "parameters": []
+        },
+        "endPosition": "130",
+        "kind": "PROPERTY",
+        "setter": "null",
+        "value": "null",
+        "startPosition": "105",
+        "key": {
+          "endPosition": "110",
+          "kind": "IDENTIFIER",
+          "name": "y",
+          "startPosition": "109"
+        }
+      }
+    ]
+  },
+  {
+    "endPosition": "206",
+    "kind": "OBJECT_LITERAL",
+    "startPosition": "138",
+    "properties": [
+      {
+        "getter": {
+          "endPosition": "150",
+          "kind": "FUNCTION_EXPRESSION",
+          "name": "null",
+          "body": {
+            "endPosition": "168",
+            "kind": "BLOCK",
+            "statements": [
+              {
+                "expression": {
+                  "identifier": "_foo",
+                  "expression": {
+                    "endPosition": "163",
+                    "kind": "IDENTIFIER",
+                    "name": "this",
+                    "startPosition": "159"
+                  },
+                  "endPosition": "168",
+                  "kind": "MEMBER_SELECT",
+                  "startPosition": "159"
+                },
+                "endPosition": "168",
+                "kind": "RETURN",
+                "startPosition": "152"
+              }
+            ],
+            "startPosition": "150"
+          },
+          "strict": "false",
+          "startPosition": "150",
+          "parameters": []
+        },
+        "endPosition": "170",
+        "kind": "PROPERTY",
+        "setter": {
+          "endPosition": "185",
+          "kind": "FUNCTION_EXPRESSION",
+          "name": "null",
+          "body": {
+            "endPosition": "202",
+            "kind": "BLOCK",
+            "statements": [
+              {
+                "expression": {
+                  "expression": {
+                    "endPosition": "202",
+                    "kind": "IDENTIFIER",
+                    "name": "val",
+                    "startPosition": "199"
+                  },
+                  "endPosition": "202",
+                  "kind": "ASSIGNMENT",
+                  "variable": {
+                    "identifier": "_foo",
+                    "expression": {
+                      "endPosition": "191",
+                      "kind": "IDENTIFIER",
+                      "name": "this",
+                      "startPosition": "187"
+                    },
+                    "endPosition": "196",
+                    "kind": "MEMBER_SELECT",
+                    "startPosition": "187"
+                  },
+                  "startPosition": "187"
+                },
+                "endPosition": "202",
+                "kind": "EXPRESSION_STATEMENT",
+                "startPosition": "187"
+              }
+            ],
+            "startPosition": "185"
+          },
+          "strict": "false",
+          "startPosition": "185",
+          "parameters": [
+            {
+              "endPosition": "183",
+              "kind": "IDENTIFIER",
+              "name": "val",
+              "startPosition": "180"
+            }
+          ]
+        },
+        "value": "null",
+        "startPosition": "140",
+        "key": {
+          "endPosition": "147",
+          "kind": "IDENTIFIER",
+          "name": "foo",
+          "startPosition": "144"
+        }
+      }
+    ]
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/property.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation property tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+var o = {
+ foo :'test',
+ _foo: call(),
+ $foo: function () {},
+ fo42: {}
+}
+
+EOF
+
+parse("property.js", code, "-nse", new (Java.extend(visitor, {
+    visitProperty : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/property.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,92 @@
+[
+  {
+    "getter": "null",
+    "endPosition": "17",
+    "kind": "PROPERTY",
+    "setter": "null",
+    "value": {
+      "endPosition": "22",
+      "kind": "STRING_LITERAL",
+      "value": "test",
+      "startPosition": "18"
+    },
+    "startPosition": "12",
+    "key": {
+      "endPosition": "15",
+      "kind": "IDENTIFIER",
+      "name": "foo",
+      "startPosition": "12"
+    }
+  },
+  {
+    "getter": "null",
+    "endPosition": "31",
+    "kind": "PROPERTY",
+    "setter": "null",
+    "value": {
+      "endPosition": "38",
+      "kind": "FUNCTION_INVOCATION",
+      "functionSelect": {
+        "endPosition": "36",
+        "kind": "IDENTIFIER",
+        "name": "call",
+        "startPosition": "32"
+      },
+      "arguments": [],
+      "startPosition": "32"
+    },
+    "startPosition": "26",
+    "key": {
+      "endPosition": "30",
+      "kind": "IDENTIFIER",
+      "name": "_foo",
+      "startPosition": "26"
+    }
+  },
+  {
+    "getter": "null",
+    "endPosition": "46",
+    "kind": "PROPERTY",
+    "setter": "null",
+    "value": {
+      "endPosition": "59",
+      "kind": "FUNCTION_EXPRESSION",
+      "name": "null",
+      "body": {
+        "endPosition": "60",
+        "kind": "BLOCK",
+        "statements": [],
+        "startPosition": "59"
+      },
+      "strict": "false",
+      "startPosition": "59",
+      "parameters": []
+    },
+    "startPosition": "41",
+    "key": {
+      "endPosition": "45",
+      "kind": "IDENTIFIER",
+      "name": "$foo",
+      "startPosition": "41"
+    }
+  },
+  {
+    "getter": "null",
+    "endPosition": "69",
+    "kind": "PROPERTY",
+    "setter": "null",
+    "value": {
+      "endPosition": "72",
+      "kind": "OBJECT_LITERAL",
+      "startPosition": "70",
+      "properties": []
+    },
+    "startPosition": "64",
+    "key": {
+      "endPosition": "68",
+      "kind": "IDENTIFIER",
+      "name": "fo42",
+      "startPosition": "64"
+    }
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/regexp.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation regexp expression tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+/[abc]/i;
+/([^abc])*([a-z])+([^0-9])?(x|y)/ig.test();
+/^\w\W\n\f\0$/igm;
+
+EOF
+
+parse("regexp.js", code, "-nse", new (Java.extend(visitor, {
+    visitRegExpLiteral : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/regexp.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,23 @@
+[
+  {
+    "endPosition": "9",
+    "kind": "REGEXP_LITERAL",
+    "options": "i",
+    "pattern": "[abc]",
+    "startPosition": "1"
+  },
+  {
+    "endPosition": "46",
+    "kind": "REGEXP_LITERAL",
+    "options": "ig",
+    "pattern": "([^abc])*([a-z])+([^0-9])?(x|y)",
+    "startPosition": "11"
+  },
+  {
+    "endPosition": "72",
+    "kind": "REGEXP_LITERAL",
+    "options": "igm",
+    "pattern": "^\\w\\W\\n\\f\\0$",
+    "startPosition": "55"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/return.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation return expression tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+function a () {
+    return 1;
+}
+function b () {
+    return function () {
+        return {}
+    }
+}
+function c() {
+    for(;;) {
+        return;
+    }
+    return
+}
+
+function d () {
+    while(true) {
+        return
+    }
+}
+
+EOF
+
+parse("return.js", code, "-nse", new (Java.extend(visitor, {
+    visitReturn : function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/return.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,62 @@
+[
+  {
+    "expression": {
+      "endPosition": "29",
+      "kind": "NUMBER_LITERAL",
+      "value": "1",
+      "startPosition": "28"
+    },
+    "endPosition": "30",
+    "kind": "RETURN",
+    "startPosition": "21"
+  },
+  {
+    "expression": {
+      "endPosition": "72",
+      "kind": "FUNCTION_EXPRESSION",
+      "name": "null",
+      "body": {
+        "endPosition": "91",
+        "kind": "BLOCK",
+        "statements": [
+          {
+            "expression": {
+              "endPosition": "91",
+              "kind": "OBJECT_LITERAL",
+              "startPosition": "89",
+              "properties": []
+            },
+            "endPosition": "91",
+            "kind": "RETURN",
+            "startPosition": "82"
+          }
+        ],
+        "startPosition": "72"
+      },
+      "strict": "false",
+      "startPosition": "72",
+      "parameters": []
+    },
+    "endPosition": "97",
+    "kind": "RETURN",
+    "startPosition": "53"
+  },
+  {
+    "expression": "null",
+    "endPosition": "144",
+    "kind": "RETURN",
+    "startPosition": "137"
+  },
+  {
+    "expression": "null",
+    "endPosition": "161",
+    "kind": "RETURN",
+    "startPosition": "155"
+  },
+  {
+    "expression": "null",
+    "endPosition": "213",
+    "kind": "RETURN",
+    "startPosition": "207"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/switch.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation switch statement tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+switch (key) {};
+switch (key) {
+    case 2: hello();
+    break;
+};
+switch (key) {
+    case 4: hello(); break;
+    case 2: world(); break;
+    default: break
+};
+
+EOF
+
+parse("switch.js", code, "-nse", new (Java.extend(visitor, {
+    visitSwitch: function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/switch.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,162 @@
+[
+  {
+    "cases": [],
+    "expression": {
+      "endPosition": "12",
+      "kind": "IDENTIFIER",
+      "name": "key",
+      "startPosition": "9"
+    },
+    "endPosition": "16",
+    "kind": "SWITCH",
+    "startPosition": "1"
+  },
+  {
+    "cases": [
+      {
+        "expression": {
+          "endPosition": "43",
+          "kind": "NUMBER_LITERAL",
+          "value": "2",
+          "startPosition": "42"
+        },
+        "endPosition": "64",
+        "kind": "CASE",
+        "statements": [
+          {
+            "expression": {
+              "endPosition": "52",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "endPosition": "50",
+                "kind": "IDENTIFIER",
+                "name": "hello",
+                "startPosition": "45"
+              },
+              "arguments": [],
+              "startPosition": "45"
+            },
+            "endPosition": "52",
+            "kind": "EXPRESSION_STATEMENT",
+            "startPosition": "45"
+          },
+          {
+            "endPosition": "64",
+            "kind": "BREAK",
+            "label": "null",
+            "startPosition": "58"
+          }
+        ],
+        "startPosition": "37"
+      }
+    ],
+    "expression": {
+      "endPosition": "29",
+      "kind": "IDENTIFIER",
+      "name": "key",
+      "startPosition": "26"
+    },
+    "endPosition": "66",
+    "kind": "SWITCH",
+    "startPosition": "18"
+  },
+  {
+    "cases": [
+      {
+        "expression": {
+          "endPosition": "93",
+          "kind": "NUMBER_LITERAL",
+          "value": "4",
+          "startPosition": "92"
+        },
+        "endPosition": "110",
+        "kind": "CASE",
+        "statements": [
+          {
+            "expression": {
+              "endPosition": "102",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "endPosition": "100",
+                "kind": "IDENTIFIER",
+                "name": "hello",
+                "startPosition": "95"
+              },
+              "arguments": [],
+              "startPosition": "95"
+            },
+            "endPosition": "102",
+            "kind": "EXPRESSION_STATEMENT",
+            "startPosition": "95"
+          },
+          {
+            "endPosition": "110",
+            "kind": "BREAK",
+            "label": "null",
+            "startPosition": "104"
+          }
+        ],
+        "startPosition": "87"
+      },
+      {
+        "expression": {
+          "endPosition": "121",
+          "kind": "NUMBER_LITERAL",
+          "value": "2",
+          "startPosition": "120"
+        },
+        "endPosition": "138",
+        "kind": "CASE",
+        "statements": [
+          {
+            "expression": {
+              "endPosition": "130",
+              "kind": "FUNCTION_INVOCATION",
+              "functionSelect": {
+                "endPosition": "128",
+                "kind": "IDENTIFIER",
+                "name": "world",
+                "startPosition": "123"
+              },
+              "arguments": [],
+              "startPosition": "123"
+            },
+            "endPosition": "130",
+            "kind": "EXPRESSION_STATEMENT",
+            "startPosition": "123"
+          },
+          {
+            "endPosition": "138",
+            "kind": "BREAK",
+            "label": "null",
+            "startPosition": "132"
+          }
+        ],
+        "startPosition": "115"
+      },
+      {
+        "expression": "null",
+        "endPosition": "157",
+        "kind": "CASE",
+        "statements": [
+          {
+            "endPosition": "157",
+            "kind": "BREAK",
+            "label": "null",
+            "startPosition": "152"
+          }
+        ],
+        "startPosition": "143"
+      }
+    ],
+    "expression": {
+      "endPosition": "79",
+      "kind": "IDENTIFIER",
+      "name": "key",
+      "startPosition": "76"
+    },
+    "endPosition": "159",
+    "kind": "SWITCH",
+    "startPosition": "68"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/throw.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation throw statement tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+throw err;
+throw 'wrong';
+throw new TypeError;
+throw new TypeError('not an array');
+throw { msg: 'wrong!' };
+
+EOF
+
+parse("throw.js", code, "-nse", new (Java.extend(visitor, {
+    visitThrow: function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/throw.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,106 @@
+[
+  {
+    "expression": {
+      "endPosition": "10",
+      "kind": "IDENTIFIER",
+      "name": "err",
+      "startPosition": "7"
+    },
+    "endPosition": "11",
+    "kind": "THROW",
+    "startPosition": "1"
+  },
+  {
+    "expression": {
+      "endPosition": "24",
+      "kind": "STRING_LITERAL",
+      "value": "wrong",
+      "startPosition": "19"
+    },
+    "endPosition": "26",
+    "kind": "THROW",
+    "startPosition": "12"
+  },
+  {
+    "expression": {
+      "constructorExpression": {
+        "endPosition": "46",
+        "kind": "FUNCTION_INVOCATION",
+        "functionSelect": {
+          "endPosition": "46",
+          "kind": "IDENTIFIER",
+          "name": "TypeError",
+          "startPosition": "37"
+        },
+        "arguments": [],
+        "startPosition": "37"
+      },
+      "endPosition": "46",
+      "kind": "NEW",
+      "startPosition": "33"
+    },
+    "endPosition": "47",
+    "kind": "THROW",
+    "startPosition": "27"
+  },
+  {
+    "expression": {
+      "constructorExpression": {
+        "endPosition": "83",
+        "kind": "FUNCTION_INVOCATION",
+        "functionSelect": {
+          "endPosition": "67",
+          "kind": "IDENTIFIER",
+          "name": "TypeError",
+          "startPosition": "58"
+        },
+        "arguments": [
+          {
+            "endPosition": "81",
+            "kind": "STRING_LITERAL",
+            "value": "not an array",
+            "startPosition": "69"
+          }
+        ],
+        "startPosition": "58"
+      },
+      "endPosition": "83",
+      "kind": "NEW",
+      "startPosition": "54"
+    },
+    "endPosition": "84",
+    "kind": "THROW",
+    "startPosition": "48"
+  },
+  {
+    "expression": {
+      "endPosition": "108",
+      "kind": "OBJECT_LITERAL",
+      "startPosition": "91",
+      "properties": [
+        {
+          "getter": "null",
+          "endPosition": "97",
+          "kind": "PROPERTY",
+          "setter": "null",
+          "value": {
+            "endPosition": "105",
+            "kind": "STRING_LITERAL",
+            "value": "wrong!",
+            "startPosition": "99"
+          },
+          "startPosition": "93",
+          "key": {
+            "endPosition": "96",
+            "kind": "IDENTIFIER",
+            "name": "msg",
+            "startPosition": "93"
+          }
+        }
+      ]
+    },
+    "endPosition": "109",
+    "kind": "THROW",
+    "startPosition": "85"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/try.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * Tests to check representation try statement tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+try { } catch (e) { }
+try { } catch (e) { } finally {}
+try { } finally {}
+try { } catch (e) { handle() }
+try { that() } catch (e) { handle() } finally { clean() }
+
+EOF
+
+parse("throw.js", code, "-nse", new (Java.extend(visitor, {
+    visitTry: function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/try.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,230 @@
+[
+  {
+    "endPosition": "22",
+    "kind": "TRY",
+    "catches": [
+      {
+        "condition": "null",
+        "endPosition": "22",
+        "kind": "CATCH",
+        "parameter": {
+          "endPosition": "17",
+          "kind": "IDENTIFIER",
+          "name": "e",
+          "startPosition": "16"
+        },
+        "block": {
+          "endPosition": "22",
+          "kind": "BLOCK",
+          "statements": [],
+          "startPosition": "19"
+        },
+        "startPosition": "9"
+      }
+    ],
+    "block": {
+      "endPosition": "8",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "5"
+    },
+    "finallyBlock": "null",
+    "startPosition": "1"
+  },
+  {
+    "endPosition": "55",
+    "kind": "TRY",
+    "catches": [
+      {
+        "condition": "null",
+        "endPosition": "44",
+        "kind": "CATCH",
+        "parameter": {
+          "endPosition": "39",
+          "kind": "IDENTIFIER",
+          "name": "e",
+          "startPosition": "38"
+        },
+        "block": {
+          "endPosition": "44",
+          "kind": "BLOCK",
+          "statements": [],
+          "startPosition": "41"
+        },
+        "startPosition": "31"
+      }
+    ],
+    "block": {
+      "endPosition": "30",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "27"
+    },
+    "finallyBlock": {
+      "endPosition": "55",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "53"
+    },
+    "startPosition": "23"
+  },
+  {
+    "endPosition": "74",
+    "kind": "TRY",
+    "catches": [],
+    "block": {
+      "endPosition": "63",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "60"
+    },
+    "finallyBlock": {
+      "endPosition": "74",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "72"
+    },
+    "startPosition": "56"
+  },
+  {
+    "endPosition": "105",
+    "kind": "TRY",
+    "catches": [
+      {
+        "condition": "null",
+        "endPosition": "105",
+        "kind": "CATCH",
+        "parameter": {
+          "endPosition": "91",
+          "kind": "IDENTIFIER",
+          "name": "e",
+          "startPosition": "90"
+        },
+        "block": {
+          "endPosition": "105",
+          "kind": "BLOCK",
+          "statements": [
+            {
+              "expression": {
+                "endPosition": "103",
+                "kind": "FUNCTION_INVOCATION",
+                "functionSelect": {
+                  "endPosition": "101",
+                  "kind": "IDENTIFIER",
+                  "name": "handle",
+                  "startPosition": "95"
+                },
+                "arguments": [],
+                "startPosition": "95"
+              },
+              "endPosition": "103",
+              "kind": "EXPRESSION_STATEMENT",
+              "startPosition": "95"
+            }
+          ],
+          "startPosition": "93"
+        },
+        "startPosition": "83"
+      }
+    ],
+    "block": {
+      "endPosition": "82",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "79"
+    },
+    "finallyBlock": "null",
+    "startPosition": "75"
+  },
+  {
+    "endPosition": "163",
+    "kind": "TRY",
+    "catches": [
+      {
+        "condition": "null",
+        "endPosition": "143",
+        "kind": "CATCH",
+        "parameter": {
+          "endPosition": "129",
+          "kind": "IDENTIFIER",
+          "name": "e",
+          "startPosition": "128"
+        },
+        "block": {
+          "endPosition": "143",
+          "kind": "BLOCK",
+          "statements": [
+            {
+              "expression": {
+                "endPosition": "141",
+                "kind": "FUNCTION_INVOCATION",
+                "functionSelect": {
+                  "endPosition": "139",
+                  "kind": "IDENTIFIER",
+                  "name": "handle",
+                  "startPosition": "133"
+                },
+                "arguments": [],
+                "startPosition": "133"
+              },
+              "endPosition": "141",
+              "kind": "EXPRESSION_STATEMENT",
+              "startPosition": "133"
+            }
+          ],
+          "startPosition": "131"
+        },
+        "startPosition": "121"
+      }
+    ],
+    "block": {
+      "endPosition": "120",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "expression": {
+            "endPosition": "118",
+            "kind": "FUNCTION_INVOCATION",
+            "functionSelect": {
+              "endPosition": "116",
+              "kind": "IDENTIFIER",
+              "name": "that",
+              "startPosition": "112"
+            },
+            "arguments": [],
+            "startPosition": "112"
+          },
+          "endPosition": "118",
+          "kind": "EXPRESSION_STATEMENT",
+          "startPosition": "112"
+        }
+      ],
+      "startPosition": "110"
+    },
+    "finallyBlock": {
+      "endPosition": "163",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "expression": {
+            "endPosition": "161",
+            "kind": "FUNCTION_INVOCATION",
+            "functionSelect": {
+              "endPosition": "159",
+              "kind": "IDENTIFIER",
+              "name": "clean",
+              "startPosition": "154"
+            },
+            "arguments": [],
+            "startPosition": "154"
+          },
+          "endPosition": "161",
+          "kind": "EXPRESSION_STATEMENT",
+          "startPosition": "154"
+        }
+      ],
+      "startPosition": "152"
+    },
+    "startPosition": "106"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/unary.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation unary expressions tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+x++;
+x--;
+delete x;
+void x;
+typeof x;
+++x;
+--x;
++x;
+-x;
+~x;
+!x;
+
+EOF
+
+parse("unary.js", code, "-nse", new (Java.extend(visitor, {
+    visitUnary: function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/unary.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,123 @@
+[
+  {
+    "expression": {
+      "endPosition": "2",
+      "kind": "IDENTIFIER",
+      "name": "x",
+      "startPosition": "1"
+    },
+    "endPosition": "4",
+    "kind": "POSTFIX_INCREMENT",
+    "startPosition": "1"
+  },
+  {
+    "expression": {
+      "endPosition": "7",
+      "kind": "IDENTIFIER",
+      "name": "x",
+      "startPosition": "6"
+    },
+    "endPosition": "9",
+    "kind": "POSTFIX_DECREMENT",
+    "startPosition": "6"
+  },
+  {
+    "expression": {
+      "endPosition": "19",
+      "kind": "IDENTIFIER",
+      "name": "x",
+      "startPosition": "18"
+    },
+    "endPosition": "19",
+    "kind": "DELETE",
+    "startPosition": "11"
+  },
+  {
+    "expression": {
+      "endPosition": "27",
+      "kind": "IDENTIFIER",
+      "name": "x",
+      "startPosition": "26"
+    },
+    "endPosition": "27",
+    "kind": "VOID",
+    "startPosition": "21"
+  },
+  {
+    "expression": {
+      "endPosition": "37",
+      "kind": "IDENTIFIER",
+      "name": "x",
+      "startPosition": "36"
+    },
+    "endPosition": "37",
+    "kind": "TYPEOF",
+    "startPosition": "29"
+  },
+  {
+    "expression": {
+      "endPosition": "42",
+      "kind": "IDENTIFIER",
+      "name": "x",
+      "startPosition": "41"
+    },
+    "endPosition": "42",
+    "kind": "PREFIX_INCREMENT",
+    "startPosition": "39"
+  },
+  {
+    "expression": {
+      "endPosition": "47",
+      "kind": "IDENTIFIER",
+      "name": "x",
+      "startPosition": "46"
+    },
+    "endPosition": "47",
+    "kind": "PREFIX_DECREMENT",
+    "startPosition": "44"
+  },
+  {
+    "expression": {
+      "endPosition": "51",
+      "kind": "IDENTIFIER",
+      "name": "x",
+      "startPosition": "50"
+    },
+    "endPosition": "51",
+    "kind": "PLUS",
+    "startPosition": "49"
+  },
+  {
+    "expression": {
+      "endPosition": "55",
+      "kind": "IDENTIFIER",
+      "name": "x",
+      "startPosition": "54"
+    },
+    "endPosition": "55",
+    "kind": "MINUS",
+    "startPosition": "53"
+  },
+  {
+    "expression": {
+      "endPosition": "59",
+      "kind": "IDENTIFIER",
+      "name": "x",
+      "startPosition": "58"
+    },
+    "endPosition": "59",
+    "kind": "BITWISE_COMPLEMENT",
+    "startPosition": "57"
+  },
+  {
+    "expression": {
+      "endPosition": "63",
+      "kind": "IDENTIFIER",
+      "name": "x",
+      "startPosition": "62"
+    },
+    "endPosition": "63",
+    "kind": "LOGICAL_COMPLEMENT",
+    "startPosition": "61"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/utils.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+/**
+ *
+ * @subtest
+ */
+
+var parser = Java.type('jdk.nashorn.api.tree.Parser');
+var tree = Java.type('jdk.nashorn.api.tree.Tree');
+var list = Java.type('java.util.List');
+var visitor = Java.type('jdk.nashorn.api.tree.SimpleTreeVisitorES5_1');
+var file = Java.type('java.io.File')
+var cls = Java.type('java.lang.Class')
+
+function convert (value) {
+    if (!value) {
+        return value;
+    }
+    var  obj = Object.bindProperties({}, value)
+    var result = {}
+    for (var i in obj) {
+        var val = obj[i]
+        if (typeof(val) == 'object') {
+            if (val instanceof cls) {
+                continue;
+            }
+            if (val instanceof tree) {
+                result[i] = convert(val)
+            }
+            else if (val instanceof list) {
+                var lst = []
+                for (var j in val) {
+                    lst.push(convert(val[j]))
+                }
+                result[i] = lst
+            }
+            else {
+                result[i] = String(val)
+            }
+        } else if (typeof(val) != 'function') {
+            result[i] = String(val)
+        }
+    }
+    return result
+}
+
+function parse(name, code, args, visitor, listener) {
+    var tree =  parser.create(args).parse(name, code, listener || null)
+    var results = []
+    tree.accept(visitor, results)
+    print(JSON.stringify(results, null, 2))
+}
+
+
+function parseDiagnostic (code, args) {
+    var messages = new Array()
+    var tree = parser.create(args).parse("test.js",  code, function (message) {
+        messages.push(convert(message))
+    })
+    print(JSON.stringify(messages, null, 2))
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/variable.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation variable statement tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+var a
+var x = 1
+var x23, $y = 1, _z
+
+EOF
+
+parse("variable.js", code, "-nse", new (Java.extend(visitor, {
+    visitVariable: function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/variable.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,47 @@
+[
+  {
+    "endPosition": "6",
+    "kind": "VARIABLE",
+    "name": "a",
+    "startPosition": "5",
+    "initializer": "null"
+  },
+  {
+    "endPosition": "16",
+    "kind": "VARIABLE",
+    "name": "x",
+    "startPosition": "11",
+    "initializer": {
+      "endPosition": "16",
+      "kind": "NUMBER_LITERAL",
+      "value": "1",
+      "startPosition": "15"
+    }
+  },
+  {
+    "endPosition": "24",
+    "kind": "VARIABLE",
+    "name": "x23",
+    "startPosition": "21",
+    "initializer": "null"
+  },
+  {
+    "endPosition": "32",
+    "kind": "VARIABLE",
+    "name": "$y",
+    "startPosition": "26",
+    "initializer": {
+      "endPosition": "32",
+      "kind": "NUMBER_LITERAL",
+      "value": "1",
+      "startPosition": "31"
+    }
+  },
+  {
+    "endPosition": "36",
+    "kind": "VARIABLE",
+    "name": "_z",
+    "startPosition": "34",
+    "initializer": "null"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/while.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation while statement tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+while(true);
+while(false) {}
+while(2 > 1) {}
+label:while(fun()) { break label}
+label:while(!fun()) continue label;
+while(true) continue
+
+EOF
+
+parse("while.js", code, "-nse", new (Java.extend(visitor, {
+    visitWhileLoop: function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/while.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,138 @@
+[
+  {
+    "condition": {
+      "endPosition": "11",
+      "kind": "BOOLEAN_LITERAL",
+      "value": "true",
+      "startPosition": "7"
+    },
+    "endPosition": "13",
+    "kind": "WHILE_LOOP",
+    "statement": {
+      "endPosition": "13",
+      "kind": "EMPTY_STATEMENT",
+      "startPosition": "12"
+    },
+    "startPosition": "1"
+  },
+  {
+    "condition": {
+      "endPosition": "25",
+      "kind": "BOOLEAN_LITERAL",
+      "value": "false",
+      "startPosition": "20"
+    },
+    "endPosition": "29",
+    "kind": "WHILE_LOOP",
+    "statement": {
+      "endPosition": "29",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "27"
+    },
+    "startPosition": "14"
+  },
+  {
+    "condition": {
+      "leftOperand": {
+        "endPosition": "37",
+        "kind": "NUMBER_LITERAL",
+        "value": "2",
+        "startPosition": "36"
+      },
+      "endPosition": "41",
+      "kind": "GREATER_THAN",
+      "rightOperand": {
+        "endPosition": "41",
+        "kind": "NUMBER_LITERAL",
+        "value": "1",
+        "startPosition": "40"
+      },
+      "startPosition": "36"
+    },
+    "endPosition": "45",
+    "kind": "WHILE_LOOP",
+    "statement": {
+      "endPosition": "45",
+      "kind": "BLOCK",
+      "statements": [],
+      "startPosition": "43"
+    },
+    "startPosition": "30"
+  },
+  {
+    "condition": {
+      "endPosition": "63",
+      "kind": "FUNCTION_INVOCATION",
+      "functionSelect": {
+        "endPosition": "61",
+        "kind": "IDENTIFIER",
+        "name": "fun",
+        "startPosition": "58"
+      },
+      "arguments": [],
+      "startPosition": "58"
+    },
+    "endPosition": "79",
+    "kind": "WHILE_LOOP",
+    "statement": {
+      "endPosition": "79",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "endPosition": "78",
+          "kind": "BREAK",
+          "label": "label",
+          "startPosition": "67"
+        }
+      ],
+      "startPosition": "65"
+    },
+    "startPosition": "52"
+  },
+  {
+    "condition": {
+      "expression": {
+        "endPosition": "98",
+        "kind": "FUNCTION_INVOCATION",
+        "functionSelect": {
+          "endPosition": "96",
+          "kind": "IDENTIFIER",
+          "name": "fun",
+          "startPosition": "93"
+        },
+        "arguments": [],
+        "startPosition": "93"
+      },
+      "endPosition": "98",
+      "kind": "LOGICAL_COMPLEMENT",
+      "startPosition": "92"
+    },
+    "endPosition": "115",
+    "kind": "WHILE_LOOP",
+    "statement": {
+      "endPosition": "115",
+      "kind": "CONTINUE",
+      "label": "label",
+      "startPosition": "100"
+    },
+    "startPosition": "86"
+  },
+  {
+    "condition": {
+      "endPosition": "126",
+      "kind": "BOOLEAN_LITERAL",
+      "value": "true",
+      "startPosition": "122"
+    },
+    "endPosition": "136",
+    "kind": "WHILE_LOOP",
+    "statement": {
+      "endPosition": "136",
+      "kind": "CONTINUE",
+      "label": "null",
+      "startPosition": "128"
+    },
+    "startPosition": "116"
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/with.js	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+/**
+ * Tests to check representation with statement tree.
+ *
+ * @test
+ * @bug 8068306
+ * @option -scripting
+ * @run
+ */
+
+load(__DIR__ + "utils.js")
+
+
+var code = <<EOF
+
+with (scope) { x = y };
+with ({x:'test'}) print(x)
+with ({}) {
+    z = this.x
+}
+
+EOF
+
+parse("with.js", code, "-nse", new (Java.extend(visitor, {
+    visitWith: function (node, obj) {
+        obj.push(convert(node))
+    }
+})))
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/treeapi/with.js.EXPECTED	Fri Mar 20 13:19:47 2015 +0300
@@ -0,0 +1,143 @@
+[
+  {
+    "endPosition": "23",
+    "kind": "WITH",
+    "scope": {
+      "endPosition": "12",
+      "kind": "IDENTIFIER",
+      "name": "scope",
+      "startPosition": "7"
+    },
+    "statement": {
+      "endPosition": "23",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "expression": {
+            "expression": {
+              "endPosition": "21",
+              "kind": "IDENTIFIER",
+              "name": "y",
+              "startPosition": "20"
+            },
+            "endPosition": "21",
+            "kind": "ASSIGNMENT",
+            "variable": {
+              "endPosition": "17",
+              "kind": "IDENTIFIER",
+              "name": "x",
+              "startPosition": "16"
+            },
+            "startPosition": "16"
+          },
+          "endPosition": "21",
+          "kind": "EXPRESSION_STATEMENT",
+          "startPosition": "16"
+        }
+      ],
+      "startPosition": "14"
+    },
+    "startPosition": "1"
+  },
+  {
+    "endPosition": "51",
+    "kind": "WITH",
+    "scope": {
+      "endPosition": "41",
+      "kind": "OBJECT_LITERAL",
+      "startPosition": "31",
+      "properties": [
+        {
+          "getter": "null",
+          "endPosition": "34",
+          "kind": "PROPERTY",
+          "setter": "null",
+          "value": {
+            "endPosition": "39",
+            "kind": "STRING_LITERAL",
+            "value": "test",
+            "startPosition": "35"
+          },
+          "startPosition": "32",
+          "key": {
+            "endPosition": "33",
+            "kind": "IDENTIFIER",
+            "name": "x",
+            "startPosition": "32"
+          }
+        }
+      ]
+    },
+    "statement": {
+      "expression": {
+        "endPosition": "51",
+        "kind": "FUNCTION_INVOCATION",
+        "functionSelect": {
+          "endPosition": "48",
+          "kind": "IDENTIFIER",
+          "name": "print",
+          "startPosition": "43"
+        },
+        "arguments": [
+          {
+            "endPosition": "50",
+            "kind": "IDENTIFIER",
+            "name": "x",
+            "startPosition": "49"
+          }
+        ],
+        "startPosition": "43"
+      },
+      "endPosition": "51",
+      "kind": "EXPRESSION_STATEMENT",
+      "startPosition": "43"
+    },
+    "startPosition": "25"
+  },
+  {
+    "endPosition": "80",
+    "kind": "WITH",
+    "scope": {
+      "endPosition": "60",
+      "kind": "OBJECT_LITERAL",
+      "startPosition": "58",
+      "properties": []
+    },
+    "statement": {
+      "endPosition": "80",
+      "kind": "BLOCK",
+      "statements": [
+        {
+          "expression": {
+            "expression": {
+              "identifier": "x",
+              "expression": {
+                "endPosition": "76",
+                "kind": "IDENTIFIER",
+                "name": "this",
+                "startPosition": "72"
+              },
+              "endPosition": "78",
+              "kind": "MEMBER_SELECT",
+              "startPosition": "72"
+            },
+            "endPosition": "78",
+            "kind": "ASSIGNMENT",
+            "variable": {
+              "endPosition": "69",
+              "kind": "IDENTIFIER",
+              "name": "z",
+              "startPosition": "68"
+            },
+            "startPosition": "68"
+          },
+          "endPosition": "78",
+          "kind": "EXPRESSION_STATEMENT",
+          "startPosition": "68"
+        }
+      ],
+      "startPosition": "62"
+    },
+    "startPosition": "52"
+  }
+]