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

Function expression self-symbol not available for eval

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 9
    • 9
    • 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()

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

              Created:
              Updated:
              Resolved: