fix: do not push new token context when function is following dot/questionDot (#11388)

* fix: do not push new token context when function is following dot/questionDot

* more cautiously poping context
This commit is contained in:
Huáng Jùnliàng
2020-04-08 10:10:36 -04:00
committed by GitHub
parent fbcb251d61
commit 8b976b0670
5 changed files with 127 additions and 7 deletions

View File

@@ -101,7 +101,10 @@ tt.incDec.updateContext = function() {
};
tt._function.updateContext = tt._class.updateContext = function(prevType) {
if (
if (prevType === tt.dot || prevType === tt.questionDot) {
// when function/class follows dot/questionDot, it is part of
// (optional)MemberExpression, then we don't need to push new token context
} else if (
prevType.beforeExpr &&
prevType !== tt.semi &&
prevType !== tt._else &&