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

Anonymous function statements leak internal function names into global scope

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 9
    • None
    • core-libs
    • None
    • 8
    • b29
    • generic
    • generic

        {code}
        function () { // line 1
          print("hello from nashorn");
        }

        print(this["L:1"]); // print function on line 1
        {code}

        expected:
        undefined

        actual:
        function () { // line 1
          print("hello from nashorn");
        }

        {code:title=--print-parse}
        [<unknown>] function :program() {
            [|1|];
            var L:1 = [<unknown>] function L:1() {
                [|2|];
                print("hello from nashorn");
            }
            [|5|];
            print(this["L:1"]);
        }
        {code}

        Note that this is a Nashorn syntax extension, and it does not happen if function is assigned to a variable.

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

                Created:
                Updated:
                Resolved: