Skip to content

Commit 2e108bf

Browse files
author
Jeremy Mill
committed
fix typos
1 parent 65299b5 commit 2e108bf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

esprima/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

esprima/scanner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)