From 6a24ed1e46686be0d849fb2cae92b34a3c5f3db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 7 Apr 2020 21:17:18 -0400 Subject: [PATCH] more cautiously poping context --- packages/babel-parser/src/parser/expression.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 46e90e825507..077396d7335f 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -2129,7 +2129,10 @@ export default class ExpressionParser extends LValParser { // But there is no chance to pop the context if the keyword is consumed // as an identifier such as a property name. const context = this.state.context; - if (context[context.length - 1].token === "function") { + if ( + (name === "function" || name === "class") && + context[context.length - 1].token === "function" + ) { context.pop(); } } else {