Open ariya opened 7 years ago
It's probably worth noting that all major engines also reject such programs, contra spec.
Oh, and see old spec bug relating to this, which never got resolved.
@bakkot Confirmed. I checked the behavior of V8, SpiderMonkey, and ChakraCore.
It would be interesting to find out (1) the reason that most web browser's engine continues to violate the specification (compatibility etc) and (2) if there is any plan for those engines to start to comply to the specification in the future.
The spec question has finally been resolved in favor of making a normative change to match the behavior in most implementations, including esprima. See https://github.com/tc39/ecma262/pull/1158. I think this can be closed with no further action.
(As reported by @michaelficarra and explained by @bakkot as case 14,15,18-25 in #1502).
Test case:
Actual: An exception "Function name may not be eval or arguments in strict mode".
Expected: A valid syntax tree.
A similar test case:
Actual: An exception "Use of future reserved word in strict mode".
Expected: A valid syntax tree.
A reference for this in the specification is on Types of Source Code:
While the formal parameters are part of the function code, the declaration name however is not.