Skip to content

Commit

Permalink
fix: avoid pushing double tc.brace after tt.braceL
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jun 10, 2021
1 parent c376be7 commit ce53026
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/babel-parser/src/plugins/jsx/index.js
Expand Up @@ -614,14 +614,15 @@ export default (superClass: Class<Parser>): Class<Parser> =>
}

updateContext(prevType: TokenType): void {
super.updateContext(prevType);
const { context, type } = this.state;
if (type === tt.braceL) {
const curContext = context[context.length - 1];
if (curContext === tc.j_oTag) {
context.push(tc.brace);
} else if (curContext === tc.j_expr) {
context.push(tc.templateQuasi);
} else {
super.updateContext(prevType);
}
this.state.exprAllowed = true;
} else if (type === tt.slash && prevType === tt.jsxTagStart) {
Expand Down

0 comments on commit ce53026

Please sign in to comment.