Does 'use strict' in a FunctionBody apply strict mode FutureReservedWord restrictions to function name or arguments?

Jeff Walden jwalden+es at MIT.EDU
Fri Jan 28 16:36:30 PST 2011

Are these examples syntax errors, or no?

   function let() { 'use strict'; }
   var o1 = function let() { 'use strict'; };
   function foo(let) { 'use strict'; }
   var o2 = function foo(let) { 'use strict'; };
   var o3 = { get x(let) { 'use strict'; } };

Tentatively I'm thinking no, because the function declarations, expression, and property assignment are in global code.  The global code for all of these does not start with a DP containing "use strict", so they're not strict mode that way (10.1.1).  And none are in function code, because function code is source text parsed as part of a FunctionBody (10.1), which explicitly is not FunctionDeclaration or FunctionExpression.

If the answer is no, I wonder if this was deliberate.  The eval/arguments prohibition reaches backward to function name and to argument names.  It seems somewhat strange that this would not.

On the other hand, it would simplify my life somewhat if I didn't have to make these keyword restrictions reach backward.  ;-)


More information about the es5-discuss mailing list