fix: push new token context when braceHashL is seen (#11941)
* fix: push new token context when braceHashL is seen * Update packages/babel-parser/src/tokenizer/context.js
This commit is contained in:
@@ -31,6 +31,7 @@ export const types: {
|
||||
} = {
|
||||
braceStatement: new TokContext("{", false),
|
||||
braceExpression: new TokContext("{", true),
|
||||
recordExpression: new TokContext("#{", true),
|
||||
templateQuasi: new TokContext("${", false),
|
||||
parenStatement: new TokContext("(", false),
|
||||
parenExpression: new TokContext("(", true),
|
||||
@@ -140,3 +141,9 @@ tt.backQuote.updateContext = function () {
|
||||
tt.star.updateContext = function () {
|
||||
this.state.exprAllowed = false;
|
||||
};
|
||||
|
||||
// we don't need to update context for tt.braceBarL because we do not pop context for tt.braceBarR
|
||||
tt.braceHashL.updateContext = function () {
|
||||
this.state.context.push(types.recordExpression);
|
||||
this.state.exprAllowed = true; /* tt.braceHashL.beforeExpr */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user