Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8075448

nashorn parser API returns init variable tree object of a for loop after for loop statement tree object

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • None
    • core-libs
    • b56
    • generic
    • generic
    • Verified

    Backports

      Description

        var Parser = Java.type("jdk.nashorn.api.tree.Parser");
        var parser = Parser.create();

        var code = <<EOF
        for (var i = 0; i < 10; i++)
            print("hello");
        EOF;

        var ast = parser.parse("test.js", code, print);
        var stats = ast.sourceElements;
        print(stats[0]);
        print(stats[1]);

        Output seen:

        jdk.nashorn.api.tree.ForLoopTreeImpl@1b4c3a9
        jdk.nashorn.api.tree.VariableTreeImpl@86b9e3

        Output expected:

        jdk.nashorn.api.tree.VariableTreeImpl@86b9e3
        jdk.nashorn.api.tree.ForLoopTreeImpl@1b4c3a9

        Attachments

          Issue Links

            Activity

              People

                sundar Sundararajan Athijegannathan
                sundar Sundararajan Athijegannathan
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: