Possible bugs in 12.1.1 Early Errors of Identifier
It would be better to report these as bugs at bugs.ecmascript.org
On Feb 19, 2015, at 10:13 PM, Shinji Ikari wrote:
The second section under 12.1.1 says: IdentifierReference[Yield] : yield
BindingIdentifier[Yield] : yield
LabelIdentifier[Yield] : yield
It is a Syntax Error if this production has a [Yield] parameter.
However, they are guarded by the [~Yield] condition. Is this section informative or outdated?
yes, this appears to be unnecessary
The third section says: IdentifierReference[Yield] : Identifier
BindingIdentifier[Yield] : Identifier
LabelIdentifier[Yield] : Identifier
It is a Syntax Error if this production has a [Yield] parameter and StringValue of Identifier is "yield".
Is it possible to have the StringValue of an Identifier to be "yield"? Same applies to the second item of the the fourth section.
yes, in not strict code.
The note below says "(Unicode)... escapes cannot be used to write an Identifier whose code point sequence is the same as a ReservedWord.". These two combined seem to imply that it is possible to have a StringValue of an Identifier to be as same as a ReservedWord, but you cannot do it though some certain way, which is bothering. (like saying: "I know you cannot do it though this way, but I'm not going to tell you how to do it or whether you can do it at all"). If it is not possible, we should remove the third section and the second item of the fourth section. If it is possible, we should note how it is possible.
only yield. yield acts as is an identifier in non-strict mode (except in generator functions) and as a keyword in strict mode. In neither case, can unicode escaping be used to sneak a yield equivalent code point sequence pass these rules.
The second section under 12.1.1 people.mozilla.org/~jorendorff/es6-draft.html#sec-identifiers-static-semantics-early-errors
says:
IdentifierReference[Yield] : yield
BindingIdentifier[Yield] : yield
LabelIdentifier[Yield] : yield
It is a Syntax Error if this production has a [Yield] parameter.
However, they are guarded by the [~Yield] condition. Is this section informative or outdated?
The third section says:
IdentifierReference[Yield] : Identifier
BindingIdentifier[Yield] : Identifier
LabelIdentifier[Yield] : Identifier
It is a Syntax Error if this production has a [Yield] parameter and StringValue of Identifier is "yield".
Is it possible to have the StringValue of an Identifier to be "yield"? Same applies to the second item of the the fourth section.
The note below says "(Unicode)... escapes cannot be used to write an Identifier whose code point sequence is the same as a ReservedWord.". These two combined seem to imply that it is possible to have a StringValue of an Identifier to be as same as a ReservedWord, but you cannot do it though some certain way, which is bothering. (like saying: "I know you cannot do it though this way, but I'm not going to tell you how to do it or whether you can do it at all"). If it is not possible, we should remove the third section and the second item of the fourth section. If it is possible, we should note how it is possible.
Thanks, Bei