Anonymous function statements leak internal function names into global scope

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P5
    • 9
    • Affects Version/s: None
    • Component/s: 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.

              Assignee:
              Sundararajan Athijegannathan
              Reporter:
              Andreas Woess
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: