Details
-
Bug
-
Resolution: Fixed
-
P3
-
None
-
None
-
b89
-
generic
-
generic
-
Verified
Description
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)
(Note: FunctionExpression can still appear anywhere any expression can)