Function expression self-symbol not available for eval

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P4
    • 9
    • Affects Version/s: 9
    • Component/s: core-libs
    • None

      The below program correctly prints "tada!" when run on v8; it incorrectly prints "TypeError: Cannot read property "x" from undefined" with Nashorn. The reason is that the self-symbol in the expression ("f") is not recognized as being potentially used when the function has eval inside of itself.

      var g = function f() { print(eval("f.x")) }
      g.x = "tada!"
      g()

            Assignee:
            Attila Szegedi
            Reporter:
            Attila Szegedi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: