(As reported by @michaelficarra and explained by @bakkot as case 14,15,18-25 in #1502).
Test case:
esprima.parse('function eval() {"use strict"; }');
Actual: An exception "Function name may not be eval or arguments in strict mode".
Expected: A valid syntax tree.
A similar test case:
esprima.parse('function static() {"use strict"; }');
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:
Function code is source text that is parsed to supply the value of the [[ECMAScriptCode]] and [[FormalParameters]] internal slots (see 9.2) of an ECMAScript function object.
While the formal parameters are part of the function code, the declaration name however is not.
(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.