Skip to content

Commit

Permalink
more cautiously poping context
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Apr 8, 2020
1 parent a97c833 commit 6a24ed1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/babel-parser/src/parser/expression.js
Expand Up @@ -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 {
Expand Down

0 comments on commit 6a24ed1

Please sign in to comment.