archives

« Bugzilla Issues Index

#4145 — 10.2.1: definition of strict function code


In 10.2.1 "Strict Mode Code",...

{1}
bullet 5 says:
Function code is strict mode code if its FunctionDeclaration,
FunctionExpression, GeneratorDeclaration, GeneratorExpression,
MethodDefinition, or ArrowFunction is contained in strict mode code ...

This is an unusual use of the word "its". Normally, when the spec introduces a parse tree node X and then refers to "its <nonterminal>", it's talking about a *child* of X (i.e., the child that is an instance of <nonterminal>). But here it means (pretty much) the *parent* of X. You could maybe replace "its" with "the immediately containing".

{2}
bullet 5 continues:
... or if it is within a FunctionBody that begins with a Directive
Prologue that contains a Use Strict Directive.

I gather than (roughly speaking), the function code for the parameters of a strict function is also strict function code, but the above condition leaves it out.

{3}
bullet 6 says:
Function code that is supplied as the last argument to the built-in
Function constructor is strict mode code if the last argument is a
String that when processed as a FunctionBody begins with a Directive
Prologue that contains a Use Strict Directive.

Again, this leaves out the function code for parameters. Change the first occurrence of "the last argument" to just "arguments".

{4}
It seems to me that bullet 6 is just a special case of (the second half of) bullet 5. But I guess it doesn't hurt to call it out on its own.

{5}
Shouldn't there be a GeneratorFunction analogue to bullet 6? (Or you could just merge it with bullet 6.)


fixed in rev36 editor's draft


in rev36