Consider the following code: `function static(){'use strict'}`.

As far as I can tell, this is a legal Script. It would not be if `static`
is considered to be in strict mode code, since it would then be a reserved
word. However, the directive only makes the associated function code strict
(10.2.1), which does not include its BindingIdentifier:

Function code is defined to be "source text that is parsed to supply the
value of the [[ECMAScriptCode]] and [[FormalParameters]] internal slots of
an ECMAScript function object" (10.2). In particular, this does not appear
to include the name of a function declaration or expression.

Despite its apparent legality, all of [v8, SpiderMonkey, JavaScriptCore,
ChakraCore, Nashorn] do not allow it, nor does any parser I tried except
Shift.

Is this intended to be legal?
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to