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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b56
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      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

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: