Skip to content

Commit

Permalink
apply feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
lala7573 committed Jul 16, 2021
1 parent dac5990 commit 7952a1f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/babel-parser/src/plugins/typescript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2077,16 +2077,16 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.match(tt.questionDot) &&
this.lookaheadCharCode() === charCodes.lessThan
) {
state.optionalChainMember = isOptionalCall = true;
if (noCalls) {
state.stop = true;
return base;
}
state.optionalChainMember = isOptionalCall = true;
this.next();
}

if (this.isRelational("<")) {
let error;
let missingParenErrorPos;
// tsTryParseAndCatch is expensive, so avoid if not necessary.
// There are number of things we are going to "maybe" parse, like type arguments on
// tagged template expressions. If any of them fail, walk it back and continue.
Expand All @@ -2110,7 +2110,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>

if (typeArguments) {
if (isOptionalCall && !this.match(tt.parenL)) {
error = [this.state.pos, tt.parenL];
missingParenErrorPos = this.state.pos;
this.unexpected();
}

Expand Down Expand Up @@ -2150,8 +2150,8 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.unexpected();
});

if (error) {
this.unexpected(...error);
if (missingParenErrorPos) {
this.unexpected(missingParenErrorPos, tt.parenL);
}

if (result) return result;
Expand Down

0 comments on commit 7952a1f

Please sign in to comment.