Nashorn shouldn't accept FunctionDeclaration as a Statement

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 8
    • Affects Version/s: None
    • Component/s: core-libs
    • None
    • b89
    • generic
    • generic
    • Verified

      Right now, Nashorn accepts the FunctionDeclaration grammar production where Statement is expected; that used to be an ill-defined feature of old JavaScript runtimes, but ES5.1 is clear about FunctionDeclaration not being a Statement but rather a SourceElement, and as such it can only appear on the level of Program or FunctionBody, and not in other places where Statement is allowed.

      (Note: FunctionExpression can still appear anywhere any expression can)

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

              Created:
              Updated:
              Resolved: