mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-20 22:27:31 +09:00
1337143 - Tweak ExportClause parsing to eliminate a peekToken where a simpler consuming getToken could be performed.
This commit is contained in:
parent
bd6ebc2ffe
commit
bba9b43fca
1 changed files with 16 additions and 7 deletions
|
|
@ -4990,12 +4990,17 @@ Parser<FullParseHandler>::exportDeclaration()
|
||||||
// Handle the forms |export {}| and |export { ..., }| (where ...
|
// Handle the forms |export {}| and |export { ..., }| (where ...
|
||||||
// is non empty), by escaping the loop early if the next token
|
// is non empty), by escaping the loop early if the next token
|
||||||
// is }.
|
// is }.
|
||||||
if (!tokenStream.peekToken(&tt))
|
if (!tokenStream.getToken(&tt))
|
||||||
return null();
|
return null();
|
||||||
|
|
||||||
if (tt == TOK_RC)
|
if (tt == TOK_RC)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
MUST_MATCH_TOKEN(TOK_NAME, JSMSG_NO_BINDING_NAME);
|
if (tt != TOK_NAME) {
|
||||||
|
error(JSMSG_NO_BINDING_NAME);
|
||||||
|
return null();
|
||||||
|
}
|
||||||
|
|
||||||
Node bindingName = newName(tokenStream.currentName());
|
Node bindingName = newName(tokenStream.currentName());
|
||||||
if (!bindingName)
|
if (!bindingName)
|
||||||
return null();
|
return null();
|
||||||
|
|
@ -5019,14 +5024,18 @@ Parser<FullParseHandler>::exportDeclaration()
|
||||||
|
|
||||||
handler.addList(kid, exportSpec);
|
handler.addList(kid, exportSpec);
|
||||||
|
|
||||||
bool matched;
|
TokenKind next;
|
||||||
if (!tokenStream.matchToken(&matched, TOK_COMMA))
|
if (!tokenStream.getToken(&next))
|
||||||
return null();
|
return null();
|
||||||
if (!matched)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
MUST_MATCH_TOKEN(TOK_RC, JSMSG_RC_AFTER_EXPORT_SPEC_LIST);
|
if (next == TOK_RC)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (next != TOK_COMMA) {
|
||||||
|
error(JSMSG_RC_AFTER_EXPORT_SPEC_LIST);
|
||||||
|
return null();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Careful! If |from| follows, even on a new line, it must start a
|
// Careful! If |from| follows, even on a new line, it must start a
|
||||||
// FromClause:
|
// FromClause:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue