зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1288460 - Allow escape sequences in the keyword-like but non-reserved 'static' Identifier (in non-strict code). r=arai
--HG-- extra : rebase_source : fce79a5f82551c3f699e9de4bc09676b277a8688
This commit is contained in:
Родитель
327cce50c3
Коммит
335ef2b3c6
2
CLOBBER
2
CLOBBER
|
@ -22,4 +22,4 @@
|
|||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Bug 1288460 requires a clobber due to bug 1298779.
|
||||
Bug 1288460 requires another clobber due to bug 1298779.
|
||||
|
|
|
@ -848,6 +848,7 @@ Parser<ParseHandler>::checkStrictBinding(PropertyName* name, TokenPos pos)
|
|||
if (name == context->names().eval ||
|
||||
name == context->names().arguments ||
|
||||
name == context->names().let ||
|
||||
name == context->names().static_ ||
|
||||
IsKeyword(name))
|
||||
{
|
||||
JSAutoByteString bytes;
|
||||
|
@ -6306,6 +6307,13 @@ Parser<ParseHandler>::classDefinition(YieldHandling yieldHandling,
|
|||
|
||||
bool isStatic = false;
|
||||
if (tt == TOK_NAME && tokenStream.currentName() == context->names().static_) {
|
||||
MOZ_ASSERT(pc->sc()->strict(), "classes are always strict");
|
||||
|
||||
// Strict mode forbids "class" as Identifier, so it can only be the
|
||||
// unescaped keyword.
|
||||
if (!checkUnescapedName())
|
||||
return null();
|
||||
|
||||
if (!tokenStream.peekToken(&tt, TokenStream::KeywordIsName))
|
||||
return null();
|
||||
if (tt == TOK_RC) {
|
||||
|
@ -8248,6 +8256,8 @@ Parser<ParseHandler>::labelOrIdentifierReference(YieldHandling yieldHandling)
|
|||
if (pc->sc()->strict()) {
|
||||
const char* badName = ident == context->names().let
|
||||
? "let"
|
||||
: ident == context->names().static_
|
||||
? "static"
|
||||
: nullptr;
|
||||
if (badName) {
|
||||
report(ParseError, false, null(), JSMSG_RESERVED_ID, badName);
|
||||
|
@ -8296,6 +8306,8 @@ Parser<ParseHandler>::bindingIdentifier(YieldHandling yieldHandling)
|
|||
|
||||
badName = ident == context->names().let
|
||||
? "let"
|
||||
: ident == context->names().static_
|
||||
? "static"
|
||||
: nullptr;
|
||||
if (badName) {
|
||||
report(ParseError, false, null(), JSMSG_RESERVED_ID, badName);
|
||||
|
|
|
@ -44,6 +44,11 @@ t("if (1) l\\u0065t: 42;");
|
|||
t("l\\u0065t = 42;");
|
||||
t("if (1) l\\u0065t = 42;");
|
||||
|
||||
t("st\\u0061tic: 42;");
|
||||
t("if (1) st\\u0061tic: 42;");
|
||||
t("st\\u0061tic = 42;");
|
||||
t("if (1) st\\u0061tic = 42;");
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
macro(private, private_, TOK_STRICT_RESERVED) \
|
||||
macro(protected, protected_, TOK_STRICT_RESERVED) \
|
||||
macro(public, public_, TOK_STRICT_RESERVED) \
|
||||
macro(static, static_, TOK_STRICT_RESERVED) \
|
||||
/* \
|
||||
* Yield is a token inside function*. Outside of a function*, it is a \
|
||||
* future reserved keyword in strict mode, but a keyword in JS1.7 even \
|
||||
|
|
Загрузка…
Ссылка в новой задаче