File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1098,7 +1098,7 @@ def parseLeftHandSideExpressionAllowCall(self):
10981098 hasOptional = False
10991099 while True :
11001100 optional = False
1101- if self .match ('?/ .' ):
1101+ if self .match ('?.' ):
11021102 optional = True
11031103 hasOptional = True
11041104 self .expect ('?.' )
@@ -1148,7 +1148,7 @@ def parseLeftHandSideExpressionAllowCall(self):
11481148 break
11491149
11501150 self .context .allowIn = previousAllowIn
1151- if optional :
1151+ if hasOptional :
11521152 return Node .ChainExpression (expr )
11531153
11541154 return expr
Original file line number Diff line number Diff line change @@ -568,7 +568,7 @@ def scanPunctuator(self):
568568 if self .source [self .index ] == '?' :
569569 self .index += 1
570570 str = '??'
571- if self .source [self .index ] == '.' and self .source [self .index + 1 ].isdigit ():
571+ if self .source [self .index ] == '.' and not self .source [self .index + 1 ].isdigit ():
572572 # "?." in "foo?.3:0" should not be treated as optional chaining.
573573 # See https://github.com/tc39/proposal-optional-chaining#notes
574574 self .index += 1
You can’t perform that action at this time.
0 commit comments