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

Function with same body not reparsed after SyntaxError

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • core-libs
    • None
    • b63
    • generic
    • generic

        First time: parser throws SyntaxError
        jjs> Function("/a/r")
        <shell>:1 SyntaxError: <function>:1:4 Unsupported RegExp flag: r
        /a/r
            ^

        Second time: silently succeeds
        jjs> Function("/a/r")
        function () {
        /a/r
        }

        Third time also silently succeeds; trying to invoke it now throws the error during invocation:

        jjs> var x = Function("/a/r")
        jjs> x()
        <function>:2 SyntaxError: Unsupported RegExp flag: r

        This seems inconsistent.

              hannesw Hannes Wallnoefer
              attila Attila Szegedi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: