author | Nicolò Ribaudo <nicolo.ribaudo@gmail.com> |
Wed, 29 Jan 2020 07:33:39 +0000 | |
changeset 512052 | 1de45bb038fca66a8413838e3118f3b47559f995 |
parent 512051 | 0d06c43eb924e3e733a6347a02f0750b112a19c3 |
child 512053 | 70615b052db52c0a7c4e9ff54aecb1b73d440f5f |
push id | 37068 |
push user | nerli@mozilla.com |
push date | Wed, 29 Jan 2020 15:51:04 +0000 |
treeherder | mozilla-central@019ae805259f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | anba |
bugs | 1607050 |
milestone | 74.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -7603,19 +7603,22 @@ GeneralParser<ParseHandler, Unit>::field } pc_->functionScope().useAsVarScope(pc_); Node initializerExpr; TokenPos wholeInitializerPos; if (hasInitializer) { // Parse the expression for the field initializer. - initializerExpr = assignExpr(InAllowed, yieldHandling, TripledotProhibited); - if (!initializerExpr) { - return null(); + { + AutoAwaitIsKeyword awaitHandling(this, AwaitIsName); + initializerExpr = assignExpr(InAllowed, YieldIsName, TripledotProhibited); + if (!initializerExpr) { + return null(); + } } handler_.checkAndSetIsDirectRHSAnonFunction(initializerExpr); wholeInitializerPos = pos(); wholeInitializerPos.begin = firstTokenPos.begin; } else { initializerExpr = handler_.newRawUndefinedLiteral(firstTokenPos);
new file mode 100644 --- /dev/null +++ b/js/src/tests/non262/fields/await-identifier-module-1.js @@ -0,0 +1,3 @@ +// |reftest| error:SyntaxError module + +async () => class { [await] = 1 };
new file mode 100644 --- /dev/null +++ b/js/src/tests/non262/fields/await-identifier-module-2.js @@ -0,0 +1,3 @@ +// |reftest| error:SyntaxError module + +async () => class { x = await };
new file mode 100644 --- /dev/null +++ b/js/src/tests/non262/fields/await-identifier-module-3.js @@ -0,0 +1,3 @@ +// |reftest| error:SyntaxError module + +async () => class { x = await 1 };
new file mode 100644 --- /dev/null +++ b/js/src/tests/non262/fields/await-identifier-script.js @@ -0,0 +1,22 @@ +var await = 1; + +async function getClass() { + return class { + x = await; + }; +} + +getClass().then(cl => { + assertEq(new cl().x, 1); +}); + +assertEq(raisesException(SyntaxError)(` +async () => class { [await] = 1 }; +`), true); + +assertEq(raisesException(SyntaxError)(` + async () => class { x = await 1 }; +`), true); + +if (typeof reportCompare === "function") + reportCompare(true, true);