Bug 1345162 - Fix identifier handling in Parser::standaloneFunction to follow new token kinds. r=till

This commit is contained in:
Tooru Fujisawa 2017-03-08 20:36:51 +09:00
parent f6885163cd
commit 2cbcc06b8b
2 changed files with 23 additions and 1 deletions

View File

@ -2495,7 +2495,7 @@ Parser<FullParseHandler>::standaloneFunction(HandleFunction fun,
}
// Skip function name, if present.
if (tt == TOK_NAME || tt == TOK_YIELD) {
if (TokenKindIsPossibleIdentifierName(tt)) {
MOZ_ASSERT(tokenStream.currentName() == fun->explicitName());
} else {
MOZ_ASSERT(fun->explicitName() == nullptr);

View File

@ -0,0 +1,22 @@
function test(name) {
eval(`
function ${name}(stdlib, foreign, heap) {
"use asm";
var ffi = foreign.t;
return {};
}
${name}(15, 10);
`);
}
test("as");
test("async");
test("await");
test("each");
test("from");
test("get");
test("let");
test("of");
test("set");
test("static");
test("target");