Update pyjsparser 2.7.1 (5465d03) → 2.7.1 (cbd1e05).

This commit is contained in:
JackDandy 2023-01-13 23:18:33 +00:00
parent 556ad8af3c
commit bd0c014bcd
3 changed files with 58 additions and 26 deletions

View file

@ -10,6 +10,7 @@
* Update feedparser 6.0.1 (98d189fa) to 6.0.10 (5fcb3ae) * Update feedparser 6.0.1 (98d189fa) to 6.0.10 (5fcb3ae)
* Update humanize 3.5.0 (b6b0ea5) to 4.0.0 (a1514eb) * Update humanize 3.5.0 (b6b0ea5) to 4.0.0 (a1514eb)
* Update Js2Py 0.70 (92250a4) to 0.74 (2e017b8) * Update Js2Py 0.70 (92250a4) to 0.74 (2e017b8)
* Update pyjsparser 2.7.1 (5465d03) to 2.7.1 (cbd1e05)
* Update profilehooks module 1.12.0 (3ee1f60) to 1.12.1 (c3fc078) * Update profilehooks module 1.12.0 (3ee1f60) to 1.12.1 (c3fc078)
* Update Rarfile 4.0 (55fe778) to 4.1a1 (8a72967) * Update Rarfile 4.0 (55fe778) to 4.1a1 (8a72967)
* Update UnRar x64 for Windows 6.11 to 6.20 * Update UnRar x64 for Windows 6.11 to 6.20

View file

@ -1524,14 +1524,18 @@ class PyJsParser:
self.expect('(') self.expect('(')
if (self.match(')')): if (self.match(')')):
raise Ecma51NotSupported('ArrowFunction') #raise Ecma51NotSupported('ArrowFunction')
self.lex() self.lex()
if (not self.match('=>')): if (not self.match('=>')):
self.expect('=>') self.expect('=>')
return { #return {
'type': PlaceHolders.ArrowParameterPlaceHolder, # 'type': PlaceHolders.ArrowParameterPlaceHolder,
'params': [] # 'params': []
} #}
nexpr = Node()
nexpr.type = PlaceHolders.ArrowParameterPlaceHolder
nexpr.params = []
return nexpr
startToken = self.lookahead startToken = self.lookahead
if (self.match('...')): if (self.match('...')):
@ -1539,10 +1543,14 @@ class PyJsParser:
self.expect(')') self.expect(')')
if (not self.match('=>')): if (not self.match('=>')):
self.expect('=>') self.expect('=>')
return { #return {
'type': PlaceHolders.ArrowParameterPlaceHolder, # 'type': PlaceHolders.ArrowParameterPlaceHolder,
'params': [expr] # 'params': [expr]
} #}
nexpr = Node()
nexpr.type = PlaceHolders.ArrowParameterPlaceHolder
nexpr.params = [expr]
return nexpr
self.isBindingElement = true self.isBindingElement = true
expr = self.inheritCoverGrammar(self.parseAssignmentExpression) expr = self.inheritCoverGrammar(self.parseAssignmentExpression)
@ -1567,10 +1575,14 @@ class PyJsParser:
self.isBindingElement = false self.isBindingElement = false
for i in xrange(len(expressions)): for i in xrange(len(expressions)):
self.reinterpretExpressionAsPattern(expressions[i]) self.reinterpretExpressionAsPattern(expressions[i])
return { #return {
'type': PlaceHolders.ArrowParameterPlaceHolder, # 'type': PlaceHolders.ArrowParameterPlaceHolder,
'params': expressions # 'params': expressions
} #}
nexpr = Node()
nexpr.type = PlaceHolders.ArrowParameterPlaceHolder
nexpr.params = expressions
return nexpr
expressions.append( expressions.append(
self.inheritCoverGrammar(self.parseAssignmentExpression)) self.inheritCoverGrammar(self.parseAssignmentExpression))
expr = WrappingNode(startToken).finishSequenceExpression( expr = WrappingNode(startToken).finishSequenceExpression(
@ -1578,7 +1590,7 @@ class PyJsParser:
self.expect(')') self.expect(')')
if (self.match('=>')): if (self.match('=>')):
raise Ecma51NotSupported('ArrowFunction') #raise Ecma51NotSupported('ArrowFunction')
if (not self.isBindingElement): if (not self.isBindingElement):
self.throwUnexpectedToken(self.lookahead) self.throwUnexpectedToken(self.lookahead)
if (expr['type'] == Syntax.SequenceExpression): if (expr['type'] == Syntax.SequenceExpression):
@ -1586,13 +1598,17 @@ class PyJsParser:
self.reinterpretExpressionAsPattern(expr['expressions'][i]) self.reinterpretExpressionAsPattern(expr['expressions'][i])
else: else:
self.reinterpretExpressionAsPattern(expr) self.reinterpretExpressionAsPattern(expr)
expr = { #expr = {
'type': # 'type':
PlaceHolders.ArrowParameterPlaceHolder, # PlaceHolders.ArrowParameterPlaceHolder,
'params': # 'params':
expr['expressions'] # expr['expressions']
if expr['type'] == Syntax.SequenceExpression else [expr] # if expr['type'] == Syntax.SequenceExpression else [expr]
} #}
nexpr = Node()
nexpr.type = PlaceHolders.ArrowParameterPlaceHolder
nexpr.params = expr['expressions'] if expr['type'] == Syntax.SequenceExpression else [expr]
expr = nexpr
self.isBindingElement = false self.isBindingElement = false
return expr return expr
@ -2002,13 +2018,15 @@ class PyJsParser:
return { return {
'params': params, 'params': params,
'defaults': defaults, 'defaults': defaults,
'stricted': options['stricted'], #'stricted': options['stricted'],
'firstRestricted': options['firstRestricted'], 'stricted': options['stricted'] if 'stricted' in options else null,
#'firstRestricted': options['firstRestricted'],
'firstRestricted': options['firstRestricted'] if 'firstRestricted' in options else null,
'message': options.get('message') 'message': options.get('message')
} }
def parseArrowFunctionExpression(self, options, node): def parseArrowFunctionExpression(self, options, node):
raise Ecma51NotSupported('ArrowFunctionExpression') #raise Ecma51NotSupported('ArrowFunctionExpression')
if (self.hasLineTerminator): if (self.hasLineTerminator):
self.tolerateUnexpectedToken(self.lookahead) self.tolerateUnexpectedToken(self.lookahead)
self.expect('=>') self.expect('=>')
@ -2039,7 +2057,7 @@ class PyJsParser:
if (expr.type == PlaceHolders.ArrowParameterPlaceHolder if (expr.type == PlaceHolders.ArrowParameterPlaceHolder
or self.match('=>')): or self.match('=>')):
raise Ecma51NotSupported('ArrowFunctionExpression') #raise Ecma51NotSupported('ArrowFunctionExpression')
self.isAssignmentTarget = self.isBindingElement = false self.isAssignmentTarget = self.isBindingElement = false
lis = self.reinterpretAsCoverFormalsList(expr) lis = self.reinterpretAsCoverFormalsList(expr)
@ -2782,7 +2800,8 @@ class PyJsParser:
if key in options['paramSet']: if key in options['paramSet']:
options['stricted'] = param options['stricted'] = param
options['message'] = Messages.StrictParamDupe options['message'] = Messages.StrictParamDupe
elif (not options['firstRestricted']): #elif (not options['firstRestricted']):
elif (not 'firstRestricted' in options):
if (isRestrictedWord(name)): if (isRestrictedWord(name)):
options['firstRestricted'] = param options['firstRestricted'] = param
options['message'] = Messages.StrictParamName options['message'] = Messages.StrictParamName

View file

@ -27,6 +27,18 @@ class BaseNode:
self.finish() self.finish()
return self return self
def finishArrowFunctionExpression(self, params, defaults, body, expression):
self.type = Syntax.ArrowFunctionExpression
self.id = None
self.params = params
self.defaults = defaults
self.body = body
#self.rest = None
self.generator = False
self.expression = expression
self.finish()
return self
def finishAssignmentExpression(self, operator, left, right): def finishAssignmentExpression(self, operator, left, right):
self.type = Syntax.AssignmentExpression self.type = Syntax.AssignmentExpression
self.operator = operator self.operator = operator