Polish parser errors (#12258)
* polish: update AwaitNotInAsyncFunction message * polish: update YieldInParameter error message * Apply suggestions from code review Co-authored-by: Brian Ng <bng412@gmail.com> * update test fixtures Co-authored-by: Brian Ng <bng412@gmail.com>
This commit is contained in:
@@ -2343,7 +2343,12 @@ export default class ExpressionParser extends LValParser {
|
||||
|
||||
if (reservedTest(word, this.inModule)) {
|
||||
if (!this.prodParam.hasAwait && word === "await") {
|
||||
this.raise(startLoc, Errors.AwaitNotInAsyncFunction);
|
||||
this.raise(
|
||||
startLoc,
|
||||
this.hasPlugin("topLevelAwait")
|
||||
? Errors.AwaitNotInAsyncContext
|
||||
: Errors.AwaitNotInAsyncFunction,
|
||||
);
|
||||
} else {
|
||||
this.raise(startLoc, Errors.UnexpectedReservedWord, word);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user