diff --git a/esprima/messages.py b/esprima/messages.py index bb6314e..0bc0eaf 100644 --- a/esprima/messages.py +++ b/esprima/messages.py @@ -54,6 +54,7 @@ class Messages: InvalidLHSInForLoop = "Invalid left-hand side in for-loop" InvalidModuleSpecifier = "Unexpected token" InvalidRegExp = "Invalid regular expression" + InvalidTaggedTemplateOnOptionalChain = 'Invalid tagged template on optional chain' LetInLexicalBinding = "let is disallowed as a lexically bound name" MissingFromClause = "Unexpected token" MultipleDefaultsInSwitch = "More than one default clause in switch statement" diff --git a/esprima/nodes.py b/esprima/nodes.py index bbbbdb8..173912c 100644 --- a/esprima/nodes.py +++ b/esprima/nodes.py @@ -138,10 +138,11 @@ def __init__(self, label): class CallExpression(Node): - def __init__(self, callee, args): + def __init__(self, callee, args, optional): self.type = Syntax.CallExpression self.callee = callee self.arguments = args + self.optional = optional class CatchClause(Node): @@ -150,6 +151,11 @@ def __init__(self, param, body): self.param = param self.body = body +class ChainExpression(Node): + def __init__(self, expression): + self.type = Syntax.ChainExpression + self.expression = expression + class ClassBody(Node): def __init__(self, body): @@ -174,11 +180,12 @@ def __init__(self, id, superClass, body): class ComputedMemberExpression(Node): - def __init__(self, object, property): + def __init__(self, object, property, optional): self.type = Syntax.MemberExpression self.computed = True self.object = object self.property = property + self.optional = optional class ConditionalExpression(Node): @@ -472,11 +479,12 @@ def __init__(self, argument): class StaticMemberExpression(Node): - def __init__(self, object, property): + def __init__(self, object, property, optional): self.type = Syntax.MemberExpression self.computed = False self.object = object self.property = property + self.optional = optional class Super(Node): diff --git a/esprima/parser.py b/esprima/parser.py index 2309e7b..e37f64e 100644 --- a/esprima/parser.py +++ b/esprima/parser.py @@ -1095,15 +1095,15 @@ def parseLeftHandSideExpressionAllowCall(self): else: expr = self.inheritCoverGrammar(self.parseNewExpression if self.matchKeyword('new') else self.parsePrimaryExpression) + hasOptional = False while True: - if self.match('.'): - self.context.isBindingElement = False - self.context.isAssignmentTarget = True - self.expect('.') - property = self.parseIdentifierName() - expr = self.finalize(self.startNode(startToken), Node.StaticMemberExpression(expr, property)) + optional = False + if self.match('?.'): + optional = True + hasOptional = True + self.expect('?.') - elif self.match('('): + if self.match('('): asyncArrow = maybeAsync and (startToken.lineNumber == self.lookahead.lineNumber) self.context.isBindingElement = False self.context.isAssignmentTarget = False @@ -1113,27 +1113,43 @@ def parseLeftHandSideExpressionAllowCall(self): args = self.parseArguments() if expr.type is Syntax.Import and len(args) != 1: self.tolerateError(Messages.BadImportCallArity) - expr = self.finalize(self.startNode(startToken), Node.CallExpression(expr, args)) + expr = self.finalize(self.startNode(startToken), Node.CallExpression(expr, args, optional)) if asyncArrow and self.match('=>'): for arg in args: self.reinterpretExpressionAsPattern(arg) expr = Node.AsyncArrowParameterPlaceHolder(args) elif self.match('['): self.context.isBindingElement = False - self.context.isAssignmentTarget = True + self.context.isAssignmentTarget = not optional self.expect('[') property = self.isolateCoverGrammar(self.parseExpression) self.expect(']') - expr = self.finalize(self.startNode(startToken), Node.ComputedMemberExpression(expr, property)) + expr = self.finalize(self.startNode(startToken), Node.ComputedMemberExpression(expr, property, optional)) elif self.lookahead.type is Token.Template and self.lookahead.head: + # Optional template literal is not included in the spec. + # https://github.com/tc39/proposal-optional-chaining/issues/54 + if optional: + self.throwUnexpectedToken(self.lookahead) + if hasOptional: + self.throwError(Messages.InvalidTaggedTemplateOnOptionalChain) quasi = self.parseTemplateLiteral() expr = self.finalize(self.startNode(startToken), Node.TaggedTemplateExpression(expr, quasi)) + elif self.match('.') or optional: + self.context.isBindingElement = False + self.context.isAssignmentTarget = not optional + if not optional: + self.expect('.') + property = self.parseIdentifierName() + expr = self.finalize(self.startNode(startToken), Node.StaticMemberExpression(expr, property, optional)) + else: break self.context.allowIn = previousAllowIn + if hasOptional: + return Node.ChainExpression(expr) return expr @@ -1155,29 +1171,46 @@ def parseLeftHandSideExpression(self): else: expr = self.inheritCoverGrammar(self.parseNewExpression if self.matchKeyword('new') else self.parsePrimaryExpression) + hasOptional = False while True: + optional = False + if self.match('?.'): + optional = True + hasOptional = True + self.expect('?.') + if self.match('['): self.context.isBindingElement = False - self.context.isAssignmentTarget = True + self.context.isAssignmentTarget = not optional self.expect('[') property = self.isolateCoverGrammar(self.parseExpression) self.expect(']') - expr = self.finalize(node, Node.ComputedMemberExpression(expr, property)) - - elif self.match('.'): - self.context.isBindingElement = False - self.context.isAssignmentTarget = True - self.expect('.') - property = self.parseIdentifierName() - expr = self.finalize(node, Node.StaticMemberExpression(expr, property)) + expr = self.finalize(node, Node.ComputedMemberExpression(expr, property, optional)) elif self.lookahead.type is Token.Template and self.lookahead.head: + # Optional template literal is not included in the spec. + # https://github.com/tc39/proposal-optional-chaining/issues/54 + if optional: + self.throwUnexpectedToken(self.lookahead) + if hasOptional: + self.throwError(Messages.InvalidTaggedTemplateOnOptionalChain) quasi = self.parseTemplateLiteral() expr = self.finalize(node, Node.TaggedTemplateExpression(expr, quasi)) + elif self.match('.') or optional: + self.context.isBindingElement = False + self.context.isAssignmentTarget = not optional + if not optional: + self.expect('.') + property = self.parseIdentifierName() + expr = self.finalize(node, Node.StaticMemberExpression(expr, property, optional)) + else: break + if hasOptional: + return Node.ChainExpression(expr) + return expr # https://tc39.github.io/ecma262/#sec-update-expressions diff --git a/esprima/scanner.py b/esprima/scanner.py index 53502a5..31103ae 100644 --- a/esprima/scanner.py +++ b/esprima/scanner.py @@ -563,6 +563,17 @@ def scanPunctuator(self): if self.curlyStack: self.curlyStack.pop() + elif str == '?': + self.index += 1 + if self.source[self.index] == '?': + self.index += 1 + str = '??' + if self.source[self.index] == '.' and not self.source[self.index + 1].isdigit(): + # "?." in "foo?.3:0" should not be treated as optional chaining. + # See https://github.com/tc39/proposal-optional-chaining#notes + self.index += 1 + str = '?.' + elif str in ( ')', ';', @@ -570,7 +581,6 @@ def scanPunctuator(self): '[', ']', ':', - '?', '~', ): self.index += 1 diff --git a/esprima/syntax.py b/esprima/syntax.py index 001b641..983fa16 100644 --- a/esprima/syntax.py +++ b/esprima/syntax.py @@ -36,6 +36,7 @@ class Syntax: BreakStatement = "BreakStatement" CallExpression = "CallExpression" CatchClause = "CatchClause" + ChainExpression = 'ChainExpression' ClassBody = "ClassBody" ClassDeclaration = "ClassDeclaration" ClassExpression = "ClassExpression" diff --git a/test/fixtures/ES6/arrow-function/migrated_0018.tree.json b/test/fixtures/ES6/arrow-function/migrated_0018.tree.json index 493590a..d411861 100644 --- a/test/fixtures/ES6/arrow-function/migrated_0018.tree.json +++ b/test/fixtures/ES6/arrow-function/migrated_0018.tree.json @@ -65,6 +65,7 @@ } } ], + "optional": false, "range": [ 0, 13 diff --git a/test/fixtures/ES6/arrow-function/migrated_0019.tree.json b/test/fixtures/ES6/arrow-function/migrated_0019.tree.json index dfcd3e4..9e6b330 100644 --- a/test/fixtures/ES6/arrow-function/migrated_0019.tree.json +++ b/test/fixtures/ES6/arrow-function/migrated_0019.tree.json @@ -102,6 +102,7 @@ } } ], + "optional": false, "range": [ 0, 17 diff --git a/test/fixtures/ES6/destructuring-assignment/array-pattern/member-expr-in-rest.tree.json b/test/fixtures/ES6/destructuring-assignment/array-pattern/member-expr-in-rest.tree.json index ef23e8a..05bfa5a 100644 --- a/test/fixtures/ES6/destructuring-assignment/array-pattern/member-expr-in-rest.tree.json +++ b/test/fixtures/ES6/destructuring-assignment/array-pattern/member-expr-in-rest.tree.json @@ -120,7 +120,8 @@ "type": "Literal", "value": 0, "raw": "0" - } + }, + "optional": false } } ] diff --git a/test/fixtures/ES6/destructuring-assignment/array-pattern/nested-assignment.tree.json b/test/fixtures/ES6/destructuring-assignment/array-pattern/nested-assignment.tree.json index 069003b..d006cce 100644 --- a/test/fixtures/ES6/destructuring-assignment/array-pattern/nested-assignment.tree.json +++ b/test/fixtures/ES6/destructuring-assignment/array-pattern/nested-assignment.tree.json @@ -243,7 +243,8 @@ "type": "Literal", "value": 0, "raw": "0" - } + }, + "optional": false } } ] diff --git a/test/fixtures/ES6/destructuring-assignment/object-pattern/nested-cover-grammar.tree.json b/test/fixtures/ES6/destructuring-assignment/object-pattern/nested-cover-grammar.tree.json index 810f6c5..e85015c 100644 --- a/test/fixtures/ES6/destructuring-assignment/object-pattern/nested-cover-grammar.tree.json +++ b/test/fixtures/ES6/destructuring-assignment/object-pattern/nested-cover-grammar.tree.json @@ -513,7 +513,8 @@ "type": "Literal", "value": 0, "raw": "0" - } + }, + "optional": false } }, "kind": "init", diff --git a/test/fixtures/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.tree.json b/test/fixtures/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.tree.json index 80cd432..4475270 100644 --- a/test/fixtures/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.tree.json +++ b/test/fixtures/ES6/destructuring-assignment/object-pattern/object-pattern-assignment.tree.json @@ -458,7 +458,8 @@ "type": "Identifier", "name": "some_call" }, - "arguments": [] + "arguments": [], + "optional": false }, "property": { "range": [ @@ -477,7 +478,8 @@ }, "type": "Identifier", "name": "a" - } + }, + "optional": false }, "kind": "init", "method": false, @@ -569,7 +571,8 @@ }, "type": "Identifier", "name": "a" - } + }, + "optional": false }, "kind": "init", "method": false, diff --git a/test/fixtures/ES6/lexical-declaration/let_member.tree.json b/test/fixtures/ES6/lexical-declaration/let_member.tree.json index d3ef806..2638bee 100644 --- a/test/fixtures/ES6/lexical-declaration/let_member.tree.json +++ b/test/fixtures/ES6/lexical-declaration/let_member.tree.json @@ -100,7 +100,8 @@ }, "type": "Identifier", "name": "let" - } + }, + "optional": false }, "right": { "range": [ diff --git a/test/fixtures/ES6/meta-property/new-target-invoke.tree.json b/test/fixtures/ES6/meta-property/new-target-invoke.tree.json index 91931b2..a3616b9 100644 --- a/test/fixtures/ES6/meta-property/new-target-invoke.tree.json +++ b/test/fixtures/ES6/meta-property/new-target-invoke.tree.json @@ -152,7 +152,8 @@ "name": "target" } }, - "arguments": [] + "arguments": [], + "optional": false } } ] diff --git a/test/fixtures/ES6/meta-property/new-target-precedence.tree.json b/test/fixtures/ES6/meta-property/new-target-precedence.tree.json index 93e550f..a11a9e7 100644 --- a/test/fixtures/ES6/meta-property/new-target-precedence.tree.json +++ b/test/fixtures/ES6/meta-property/new-target-precedence.tree.json @@ -170,7 +170,8 @@ }, "arguments": [] }, - "arguments": [] + "arguments": [], + "optional": false } } ] diff --git a/test/fixtures/ES6/spread-element/call-multi-spread.tree.json b/test/fixtures/ES6/spread-element/call-multi-spread.tree.json index f457462..e485539 100644 --- a/test/fixtures/ES6/spread-element/call-multi-spread.tree.json +++ b/test/fixtures/ES6/spread-element/call-multi-spread.tree.json @@ -157,7 +157,8 @@ "name": "z" } } - ] + ], + "optional": false } } ], diff --git a/test/fixtures/ES6/spread-element/call-spread-default.tree.json b/test/fixtures/ES6/spread-element/call-spread-default.tree.json index 7d7ae17..c23102b 100644 --- a/test/fixtures/ES6/spread-element/call-spread-default.tree.json +++ b/test/fixtures/ES6/spread-element/call-spread-default.tree.json @@ -53,6 +53,8 @@ }, "arguments": [ { + "type": "Identifier", + "name": "g", "range": [ 2, 3 @@ -66,9 +68,7 @@ "line": 1, "column": 3 } - }, - "type": "Identifier", - "name": "g" + } }, { "range": [ @@ -141,7 +141,8 @@ } } } - ] + ], + "optional": false } } ], @@ -342,4 +343,4 @@ "column": 15 } } -} +} \ No newline at end of file diff --git a/test/fixtures/ES6/spread-element/call-spread-first.tree.json b/test/fixtures/ES6/spread-element/call-spread-first.tree.json index 751e1ad..74b08bc 100644 --- a/test/fixtures/ES6/spread-element/call-spread-first.tree.json +++ b/test/fixtures/ES6/spread-element/call-spread-first.tree.json @@ -123,7 +123,8 @@ "type": "Identifier", "name": "z" } - ] + ], + "optional": false } } ], diff --git a/test/fixtures/ES6/spread-element/call-spread-number.tree.json b/test/fixtures/ES6/spread-element/call-spread-number.tree.json index 50510e8..11e7673 100644 --- a/test/fixtures/ES6/spread-element/call-spread-number.tree.json +++ b/test/fixtures/ES6/spread-element/call-spread-number.tree.json @@ -88,7 +88,8 @@ "raw": ".5" } } - ] + ], + "optional": false } } ], diff --git a/test/fixtures/ES6/spread-element/call-spread.tree.json b/test/fixtures/ES6/spread-element/call-spread.tree.json index c8ed3cb..ce31cf2 100644 --- a/test/fixtures/ES6/spread-element/call-spread.tree.json +++ b/test/fixtures/ES6/spread-element/call-spread.tree.json @@ -87,7 +87,8 @@ "name": "g" } } - ] + ], + "optional": false } } ], diff --git a/test/fixtures/ES6/super-property/arrow_super.tree.json b/test/fixtures/ES6/super-property/arrow_super.tree.json index 6fc2055..6153fc2 100644 --- a/test/fixtures/ES6/super-property/arrow_super.tree.json +++ b/test/fixtures/ES6/super-property/arrow_super.tree.json @@ -207,7 +207,8 @@ }, "type": "Super" }, - "arguments": [] + "arguments": [], + "optional": false }, "generator": false, "expression": true, @@ -550,4 +551,4 @@ "column": 1 } } -} +} \ No newline at end of file diff --git a/test/fixtures/ES6/super-property/constructor_super.tree.json b/test/fixtures/ES6/super-property/constructor_super.tree.json index 3bc5c3d..dc928d1 100644 --- a/test/fixtures/ES6/super-property/constructor_super.tree.json +++ b/test/fixtures/ES6/super-property/constructor_super.tree.json @@ -189,7 +189,8 @@ }, "type": "Super" }, - "arguments": [] + "arguments": [], + "optional": false } } ] diff --git a/test/fixtures/ES6/super-property/new_super.tree.json b/test/fixtures/ES6/super-property/new_super.tree.json index 2a56718..282bbe1 100644 --- a/test/fixtures/ES6/super-property/new_super.tree.json +++ b/test/fixtures/ES6/super-property/new_super.tree.json @@ -223,7 +223,8 @@ }, "type": "Identifier", "name": "bar" - } + }, + "optional": false }, "arguments": [] } diff --git a/test/fixtures/ES6/super-property/super_computed.tree.json b/test/fixtures/ES6/super-property/super_computed.tree.json index c3ab8c2..313cbcc 100644 --- a/test/fixtures/ES6/super-property/super_computed.tree.json +++ b/test/fixtures/ES6/super-property/super_computed.tree.json @@ -208,7 +208,8 @@ "type": "Literal", "value": 1, "raw": "1" - } + }, + "optional": false } } ] diff --git a/test/fixtures/ES6/super-property/super_member.tree.json b/test/fixtures/ES6/super-property/super_member.tree.json index 9b9e4be..f5d53cc 100644 --- a/test/fixtures/ES6/super-property/super_member.tree.json +++ b/test/fixtures/ES6/super-property/super_member.tree.json @@ -207,7 +207,8 @@ }, "type": "Identifier", "name": "y" - } + }, + "optional": false } } ] diff --git a/test/fixtures/ES6/template-literals/invalid-hex-escape-sequence.failure.json b/test/fixtures/ES6/template-literals/invalid-hex-escape-sequence.failure.json index 706a718..167b31a 100644 --- a/test/fixtures/ES6/template-literals/invalid-hex-escape-sequence.failure.json +++ b/test/fixtures/ES6/template-literals/invalid-hex-escape-sequence.failure.json @@ -1 +1 @@ -{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Invalid hexadecimal escape sequence","description":"Invalid hexadecimal escape sequence"} \ No newline at end of file +{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: Invalid hexadecimal escape sequence","description":"Invalid hexadecimal escape sequence"} \ No newline at end of file diff --git a/test/fixtures/ES6/template-literals/literal-escape-sequences.source.js b/test/fixtures/ES6/template-literals/literal-escape-sequences.source.js index 67f21b0..534b48c 100644 --- a/test/fixtures/ES6/template-literals/literal-escape-sequences.source.js +++ b/test/fixtures/ES6/template-literals/literal-escape-sequences.source.js @@ -1 +1 @@ -var source = '`\\u{000042}\\u0042\\x42\\u0\\A\\0`'; \ No newline at end of file +var source = '`\\u{000042}\\u0042\\x42\\A\\0`'; \ No newline at end of file diff --git a/test/fixtures/ES6/template-literals/literal-escape-sequences.tree.json b/test/fixtures/ES6/template-literals/literal-escape-sequences.tree.json index d4059c2..62cb71a 100644 --- a/test/fixtures/ES6/template-literals/literal-escape-sequences.tree.json +++ b/test/fixtures/ES6/template-literals/literal-escape-sequences.tree.json @@ -4,7 +4,7 @@ { "range": [ 0, - 29 + 26 ], "loc": { "start": { @@ -13,14 +13,14 @@ }, "end": { "line": 1, - "column": 29 + "column": 26 } }, "type": "ExpressionStatement", "expression": { "range": [ 0, - 29 + 26 ], "loc": { "start": { @@ -29,7 +29,7 @@ }, "end": { "line": 1, - "column": 29 + "column": 26 } }, "type": "TemplateLiteral", @@ -37,7 +37,7 @@ { "range": [ 0, - 29 + 26 ], "loc": { "start": { @@ -46,13 +46,13 @@ }, "end": { "line": 1, - "column": 29 + "column": 26 } }, "type": "TemplateElement", "value": { - "raw": "\\u{000042}\\u0042\\x42\\u0\\A\\0", - "cooked": "BBBu0A\u0000" + "raw": "\\u{000042}\\u0042\\x42\\A\\0", + "cooked": "BBBA\u0000" }, "tail": true } @@ -65,10 +65,10 @@ "tokens": [ { "type": "Template", - "value": "`\\u{000042}\\u0042\\x42\\u0\\A\\0`", + "value": "`\\u{000042}\\u0042\\x42\\A\\0`", "range": [ 0, - 29 + 26 ], "loc": { "start": { @@ -77,14 +77,14 @@ }, "end": { "line": 1, - "column": 29 + "column": 26 } } } ], "range": [ 0, - 29 + 26 ], "loc": { "start": { @@ -93,7 +93,7 @@ }, "end": { "line": 1, - "column": 29 + "column": 26 } } } diff --git a/test/fixtures/ES6/yield/invalid-yield-object-methods.js b/test/fixtures/ES6/yield/invalid-yield-object-methods.js index 05c641e..99acd4f 100644 --- a/test/fixtures/ES6/yield/invalid-yield-object-methods.js +++ b/test/fixtures/ES6/yield/invalid-yield-object-methods.js @@ -1 +1 @@ -function *a(){({b(){yield}})} \ No newline at end of file +function *a(){({b(){yield}})} diff --git a/test/fixtures/ES6/yield/invalid-yield-object-methods.tree.json b/test/fixtures/ES6/yield/invalid-yield-object-methods.tree.json index 8dc5c06..feb0a28 100644 --- a/test/fixtures/ES6/yield/invalid-yield-object-methods.tree.json +++ b/test/fixtures/ES6/yield/invalid-yield-object-methods.tree.json @@ -534,4 +534,4 @@ "column": 29 } } -} \ No newline at end of file +} diff --git a/test/fixtures/ES6/yield/invalid-yield-object-property-getter.js b/test/fixtures/ES6/yield/invalid-yield-object-property-getter.js index 97aaba0..c741caf 100644 --- a/test/fixtures/ES6/yield/invalid-yield-object-property-getter.js +++ b/test/fixtures/ES6/yield/invalid-yield-object-property-getter.js @@ -1 +1 @@ -function *a(){({get b(){yield}})} \ No newline at end of file +function *a(){({get b(){yield}})} diff --git a/test/fixtures/ES6/yield/invalid-yield-object-property-getter.tree.json b/test/fixtures/ES6/yield/invalid-yield-object-property-getter.tree.json index fe6e7c3..8b501c9 100644 --- a/test/fixtures/ES6/yield/invalid-yield-object-property-getter.tree.json +++ b/test/fixtures/ES6/yield/invalid-yield-object-property-getter.tree.json @@ -552,4 +552,4 @@ "column": 33 } } -} \ No newline at end of file +} diff --git a/test/fixtures/ES6/yield/invalid-yield-object-property-setter.js b/test/fixtures/ES6/yield/invalid-yield-object-property-setter.js index 0858f98..4928581 100644 --- a/test/fixtures/ES6/yield/invalid-yield-object-property-setter.js +++ b/test/fixtures/ES6/yield/invalid-yield-object-property-setter.js @@ -1 +1 @@ -function *a(){({set b(c){yield}})} \ No newline at end of file +function *a(){({set b(c){yield}})} diff --git a/test/fixtures/ES6/yield/invalid-yield-object-property-setter.tree.json b/test/fixtures/ES6/yield/invalid-yield-object-property-setter.tree.json index 684706e..b7785f1 100644 --- a/test/fixtures/ES6/yield/invalid-yield-object-property-setter.tree.json +++ b/test/fixtures/ES6/yield/invalid-yield-object-property-setter.tree.json @@ -589,4 +589,4 @@ "column": 34 } } -} \ No newline at end of file +} diff --git a/test/fixtures/ES6/yield/yield-arg-super.tree.json b/test/fixtures/ES6/yield/yield-arg-super.tree.json index 8b0f799..090525f 100644 --- a/test/fixtures/ES6/yield/yield-arg-super.tree.json +++ b/test/fixtures/ES6/yield/yield-arg-super.tree.json @@ -97,6 +97,7 @@ } } }, + "optional": false, "range": [ 23, 30 @@ -113,6 +114,7 @@ } }, "arguments": [], + "optional": false, "range": [ 23, 32 diff --git a/test/fixtures/ES6/yield/yield-call-expression-property.tree.json b/test/fixtures/ES6/yield/yield-call-expression-property.tree.json index 00e6711..c2ed2cf 100644 --- a/test/fixtures/ES6/yield/yield-call-expression-property.tree.json +++ b/test/fixtures/ES6/yield/yield-call-expression-property.tree.json @@ -137,9 +137,11 @@ }, "type": "Identifier", "name": "yield" - } + }, + "optional": false }, - "arguments": [] + "arguments": [], + "optional": false } } ] diff --git a/test/fixtures/ES6/yield/yield-member-expression-property.tree.json b/test/fixtures/ES6/yield/yield-member-expression-property.tree.json index 51dee63..5e087be 100644 --- a/test/fixtures/ES6/yield/yield-member-expression-property.tree.json +++ b/test/fixtures/ES6/yield/yield-member-expression-property.tree.json @@ -137,7 +137,8 @@ }, "type": "Identifier", "name": "yield" - } + }, + "optional": false }, "delegate": false } diff --git a/test/fixtures/ES6/yield/yield-super-property.tree.json b/test/fixtures/ES6/yield/yield-super-property.tree.json index 5da9f37..22e5ca0 100644 --- a/test/fixtures/ES6/yield/yield-super-property.tree.json +++ b/test/fixtures/ES6/yield/yield-super-property.tree.json @@ -207,7 +207,8 @@ }, "type": "Identifier", "name": "yield" - } + }, + "optional": false } } ] diff --git a/test/fixtures/ESnext/classProperties.js b/test/fixtures/ESnext/classProperties.js deleted file mode 100644 index f04ada2..0000000 --- a/test/fixtures/ESnext/classProperties.js +++ /dev/null @@ -1 +0,0 @@ -class A {a=1;static b=2;} \ No newline at end of file diff --git a/test/fixtures/ESnext/classProperties.tree.json b/test/fixtures/ESnext/classProperties.tree.json deleted file mode 100644 index ee05b5c..0000000 --- a/test/fixtures/ESnext/classProperties.tree.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "body": [ - { - "body": { - "body": [ - { - "kind": "init", - "computed": false, - "value": { - "raw": "1", - "type": "Literal", - "value": 1 - }, - "key": { - "type": "Identifier", - "name": "a" - }, - "type": "FieldDefinition", - "static": false - }, - { - "kind": "init", - "computed": false, - "value": { - "raw": "2", - "type": "Literal", - "value": 2 - }, - "key": { - "type": "Identifier", - "name": "b" - }, - "type": "FieldDefinition", - "static": true - } - ], - "type": "ClassBody" - }, - "type": "ClassDeclaration", - "id": { - "type": "Identifier", - "name": "A" - } - } - ], - "type": "Program", - "sourceType": "script", - "options": { - "classProperties": true - } -} \ No newline at end of file diff --git a/test/fixtures/JSX/invalid-fragment-tag.failure.json b/test/fixtures/JSX/invalid-fragment-tag.failure.json new file mode 100644 index 0000000..ee4f816 --- /dev/null +++ b/test/fixtures/JSX/invalid-fragment-tag.failure.json @@ -0,0 +1 @@ +{"index":1,"lineNumber":1,"column":2,"message":"Error: Line 1: Unexpected token /","description":"Unexpected token /"} \ No newline at end of file diff --git a/test/fixtures/JSX/invalid-fragment-tag.js b/test/fixtures/JSX/invalid-fragment-tag.js new file mode 100644 index 0000000..8aa9357 --- /dev/null +++ b/test/fixtures/JSX/invalid-fragment-tag.js @@ -0,0 +1 @@ + diff --git a/test/fixtures/comment/migrated_0027.tree.json b/test/fixtures/comment/migrated_0027.tree.json index 4682911..3715c4e 100644 --- a/test/fixtures/comment/migrated_0027.tree.json +++ b/test/fixtures/comment/migrated_0027.tree.json @@ -47,6 +47,7 @@ } }, "arguments": [], + "optional": false, "range": [ 9, 17 diff --git a/test/fixtures/comment/migrated_0028.tree.json b/test/fixtures/comment/migrated_0028.tree.json index a9ebf97..aa4caa5 100644 --- a/test/fixtures/comment/migrated_0028.tree.json +++ b/test/fixtures/comment/migrated_0028.tree.json @@ -47,6 +47,7 @@ } }, "arguments": [], + "optional": false, "range": [ 25, 33 diff --git a/test/fixtures/comment/migrated_0029.tree.json b/test/fixtures/comment/migrated_0029.tree.json index b5bd241..f66aacd 100644 --- a/test/fixtures/comment/migrated_0029.tree.json +++ b/test/fixtures/comment/migrated_0029.tree.json @@ -47,6 +47,7 @@ } }, "arguments": [], + "optional": false, "range": [ 28, 36 diff --git a/test/fixtures/comment/migrated_0030.tree.json b/test/fixtures/comment/migrated_0030.tree.json index 34e2c6e..0f255c0 100644 --- a/test/fixtures/comment/migrated_0030.tree.json +++ b/test/fixtures/comment/migrated_0030.tree.json @@ -47,6 +47,7 @@ } }, "arguments": [], + "optional": false, "trailingComments": [ { "type": "Block", diff --git a/test/fixtures/comment/migrated_0031.tree.json b/test/fixtures/comment/migrated_0031.tree.json index 7911576..961737b 100644 --- a/test/fixtures/comment/migrated_0031.tree.json +++ b/test/fixtures/comment/migrated_0031.tree.json @@ -67,6 +67,7 @@ } }, "arguments": [], + "optional": false, "range": [ 41, 48 diff --git a/test/fixtures/comment/migrated_0032.tree.json b/test/fixtures/comment/migrated_0032.tree.json index 4c4b2b6..3f8c5b6 100644 --- a/test/fixtures/comment/migrated_0032.tree.json +++ b/test/fixtures/comment/migrated_0032.tree.json @@ -67,6 +67,7 @@ } }, "arguments": [], + "optional": false, "trailingComments": [ { "type": "Block", diff --git a/test/fixtures/comment/migrated_0033.tree.json b/test/fixtures/comment/migrated_0033.tree.json index 31e9f37..928c1f8 100644 --- a/test/fixtures/comment/migrated_0033.tree.json +++ b/test/fixtures/comment/migrated_0033.tree.json @@ -141,6 +141,7 @@ } } }, + "optional": false, "range": [ 13, 50 @@ -175,6 +176,7 @@ } } ], + "optional": false, "range": [ 13, 56 diff --git a/test/fixtures/comment/migrated_0034.tree.json b/test/fixtures/comment/migrated_0034.tree.json index d423d7c..440fff9 100644 --- a/test/fixtures/comment/migrated_0034.tree.json +++ b/test/fixtures/comment/migrated_0034.tree.json @@ -181,6 +181,7 @@ } } }, + "optional": false, "range": [ 0, 48 @@ -215,6 +216,7 @@ } } ], + "optional": false, "range": [ 0, 54 diff --git a/test/fixtures/declaration/function/migrated_0000.tree.json b/test/fixtures/declaration/function/migrated_0000.tree.json index 38f331b..0eebbb1 100644 --- a/test/fixtures/declaration/function/migrated_0000.tree.json +++ b/test/fixtures/declaration/function/migrated_0000.tree.json @@ -48,6 +48,7 @@ } }, "arguments": [], + "optional": false, "range": [ 19, 26 diff --git a/test/fixtures/declaration/function/migrated_0006.tree.json b/test/fixtures/declaration/function/migrated_0006.tree.json index dd6af54..ced7c52 100644 --- a/test/fixtures/declaration/function/migrated_0006.tree.json +++ b/test/fixtures/declaration/function/migrated_0006.tree.json @@ -67,6 +67,7 @@ } }, "arguments": [], + "optional": false, "range": [ 20, 27 diff --git a/test/fixtures/declaration/function/migrated_0007.tree.json b/test/fixtures/declaration/function/migrated_0007.tree.json index 18c4a73..b5a07a1 100644 --- a/test/fixtures/declaration/function/migrated_0007.tree.json +++ b/test/fixtures/declaration/function/migrated_0007.tree.json @@ -85,6 +85,7 @@ } }, "arguments": [], + "optional": false, "range": [ 23, 30 diff --git a/test/fixtures/declaration/function/migrated_0008.tree.json b/test/fixtures/declaration/function/migrated_0008.tree.json index 91ca843..e3e8ad9 100644 --- a/test/fixtures/declaration/function/migrated_0008.tree.json +++ b/test/fixtures/declaration/function/migrated_0008.tree.json @@ -54,6 +54,7 @@ } }, "arguments": [], + "optional": false, "range": [ 22, 29 diff --git a/test/fixtures/declaration/function/migrated_0011.tree.json b/test/fixtures/declaration/function/migrated_0011.tree.json index 530b109..e6b9358 100644 --- a/test/fixtures/declaration/function/migrated_0011.tree.json +++ b/test/fixtures/declaration/function/migrated_0011.tree.json @@ -71,6 +71,7 @@ } }, "arguments": [], + "optional": false, "range": [ 28, 35 diff --git a/test/fixtures/directive-prolog/migrated_0000.tree.json b/test/fixtures/directive-prolog/migrated_0000.tree.json index 74ec737..b94f24e 100644 --- a/test/fixtures/directive-prolog/migrated_0000.tree.json +++ b/test/fixtures/directive-prolog/migrated_0000.tree.json @@ -136,6 +136,7 @@ } }, "arguments": [], + "optional": false, "range": [ 1, 45 diff --git a/test/fixtures/directive-prolog/migrated_0001.tree.json b/test/fixtures/directive-prolog/migrated_0001.tree.json index 49af1b0..45e3b09 100644 --- a/test/fixtures/directive-prolog/migrated_0001.tree.json +++ b/test/fixtures/directive-prolog/migrated_0001.tree.json @@ -136,6 +136,7 @@ } }, "arguments": [], + "optional": false, "range": [ 1, 43 diff --git a/test/fixtures/es2017/async/arrows/async-arrow-as-last-parameter.tree.json b/test/fixtures/es2017/async/arrows/async-arrow-as-last-parameter.tree.json index 12aa57b..e3d591a 100644 --- a/test/fixtures/es2017/async/arrows/async-arrow-as-last-parameter.tree.json +++ b/test/fixtures/es2017/async/arrows/async-arrow-as-last-parameter.tree.json @@ -119,6 +119,7 @@ } } ], + "optional": false, "range": [ 0, 24 diff --git a/test/fixtures/es2017/async/arrows/async-arrow-as-parameter.tree.json b/test/fixtures/es2017/async/arrows/async-arrow-as-parameter.tree.json index 146decc..4ebd8e7 100644 --- a/test/fixtures/es2017/async/arrows/async-arrow-as-parameter.tree.json +++ b/test/fixtures/es2017/async/arrows/async-arrow-as-parameter.tree.json @@ -192,6 +192,7 @@ } } ], + "optional": false, "range": [ 0, 37 diff --git a/test/fixtures/es2017/async/functions/argument-async-function-expression.tree.json b/test/fixtures/es2017/async/functions/argument-async-function-expression.tree.json index e94cb24..9f1a103 100644 --- a/test/fixtures/es2017/async/functions/argument-async-function-expression.tree.json +++ b/test/fixtures/es2017/async/functions/argument-async-function-expression.tree.json @@ -137,6 +137,7 @@ } } ], + "optional": false, "range": [ 0, 32 diff --git a/test/fixtures/es2017/async/functions/async-function-expression-as-parameter.tree.json b/test/fixtures/es2017/async/functions/async-function-expression-as-parameter.tree.json index b57ccf5..da4a527 100644 --- a/test/fixtures/es2017/async/functions/async-function-expression-as-parameter.tree.json +++ b/test/fixtures/es2017/async/functions/async-function-expression-as-parameter.tree.json @@ -173,6 +173,7 @@ } } ], + "optional": false, "range": [ 0, 38 diff --git a/test/fixtures/es2017/async/regular-identifier/argument-async-call.tree.json b/test/fixtures/es2017/async/regular-identifier/argument-async-call.tree.json index 7615ac9..2f66da2 100644 --- a/test/fixtures/es2017/async/regular-identifier/argument-async-call.tree.json +++ b/test/fixtures/es2017/async/regular-identifier/argument-async-call.tree.json @@ -100,6 +100,7 @@ } } ], + "optional": false, "range": [ 5, 16 @@ -116,6 +117,7 @@ } } ], + "optional": false, "range": [ 0, 17 diff --git a/test/fixtures/es2017/async/regular-identifier/call-async-await.tree.json b/test/fixtures/es2017/async/regular-identifier/call-async-await.tree.json index 1d9bde3..892a458 100644 --- a/test/fixtures/es2017/async/regular-identifier/call-async-await.tree.json +++ b/test/fixtures/es2017/async/regular-identifier/call-async-await.tree.json @@ -64,6 +64,7 @@ } } ], + "optional": false, "range": [ 4, 16 diff --git a/test/fixtures/es2017/async/regular-identifier/call-async.tree.json b/test/fixtures/es2017/async/regular-identifier/call-async.tree.json index 8961234..b35c35e 100644 --- a/test/fixtures/es2017/async/regular-identifier/call-async.tree.json +++ b/test/fixtures/es2017/async/regular-identifier/call-async.tree.json @@ -64,6 +64,7 @@ } } ], + "optional": false, "range": [ 4, 12 diff --git a/test/fixtures/es2017/trailing-commas/trailing-comma-call.tree.json b/test/fixtures/es2017/trailing-commas/trailing-comma-call.tree.json index 92fc89c..d4dd2d7 100644 --- a/test/fixtures/es2017/trailing-commas/trailing-comma-call.tree.json +++ b/test/fixtures/es2017/trailing-commas/trailing-comma-call.tree.json @@ -43,6 +43,7 @@ } } ], + "optional": false, "range": [ 0, 5 diff --git a/test/fixtures/es2017/trailing-commas/trailing-comma-spread.tree.json b/test/fixtures/es2017/trailing-commas/trailing-comma-spread.tree.json index 2f09439..c90f5c2 100644 --- a/test/fixtures/es2017/trailing-commas/trailing-comma-spread.tree.json +++ b/test/fixtures/es2017/trailing-commas/trailing-comma-spread.tree.json @@ -60,6 +60,7 @@ } } ], + "optional": false, "range": [ 0, 8 diff --git a/test/fixtures/es2018/dynamic-import/await-import.tree.json b/test/fixtures/es2018/dynamic-import/await-import.tree.json index 4596b7a..282c7a9 100644 --- a/test/fixtures/es2018/dynamic-import/await-import.tree.json +++ b/test/fixtures/es2018/dynamic-import/await-import.tree.json @@ -87,6 +87,7 @@ } } ], + "optional": false, "range": [ 28, 37 diff --git a/test/fixtures/es2018/dynamic-import/coexist-import-call-import-declaration.module.tree.json b/test/fixtures/es2018/dynamic-import/coexist-import-call-import-declaration.module.tree.json index 994e3ba..77b0723 100644 --- a/test/fixtures/es2018/dynamic-import/coexist-import-call-import-declaration.module.tree.json +++ b/test/fixtures/es2018/dynamic-import/coexist-import-call-import-declaration.module.tree.json @@ -121,6 +121,7 @@ } } ], + "optional": false, "range": [ 19, 30 @@ -154,6 +155,7 @@ } } }, + "optional": false, "range": [ 19, 35 @@ -189,6 +191,7 @@ } } ], + "optional": false, "range": [ 19, 38 diff --git a/test/fixtures/es2018/dynamic-import/import-call-string.tree.json b/test/fixtures/es2018/dynamic-import/import-call-string.tree.json index 118f24b..f2653fe 100644 --- a/test/fixtures/es2018/dynamic-import/import-call-string.tree.json +++ b/test/fixtures/es2018/dynamic-import/import-call-string.tree.json @@ -48,6 +48,7 @@ } } ], + "optional": false, "range": [ 0, 16 @@ -81,6 +82,7 @@ } } }, + "optional": false, "range": [ 0, 21 @@ -116,6 +118,7 @@ } } ], + "optional": false, "range": [ 0, 29 diff --git a/test/fixtures/es2018/dynamic-import/import-call-template.tree.json b/test/fixtures/es2018/dynamic-import/import-call-template.tree.json index 358cb32..8b31c62 100644 --- a/test/fixtures/es2018/dynamic-import/import-call-template.tree.json +++ b/test/fixtures/es2018/dynamic-import/import-call-template.tree.json @@ -112,6 +112,7 @@ } } ], + "optional": false, "range": [ 0, 25 @@ -145,6 +146,7 @@ } } }, + "optional": false, "range": [ 0, 30 @@ -180,6 +182,7 @@ } } ], + "optional": false, "range": [ 0, 43 diff --git a/test/fixtures/es2018/dynamic-import/import-call-var.tree.json b/test/fixtures/es2018/dynamic-import/import-call-var.tree.json index e1657f1..b7e024b 100644 --- a/test/fixtures/es2018/dynamic-import/import-call-var.tree.json +++ b/test/fixtures/es2018/dynamic-import/import-call-var.tree.json @@ -121,6 +121,7 @@ } } ], + "optional": false, "range": [ 24, 33 @@ -154,6 +155,7 @@ } } }, + "optional": false, "range": [ 24, 38 @@ -211,6 +213,7 @@ } } ], + "optional": false, "range": [ 24, 48 diff --git a/test/fixtures/es2018/dynamic-import/invalid-import-call-many-arguments.tree.json b/test/fixtures/es2018/dynamic-import/invalid-import-call-many-arguments.tree.json index 1b0ec19..b3ba798 100644 --- a/test/fixtures/es2018/dynamic-import/invalid-import-call-many-arguments.tree.json +++ b/test/fixtures/es2018/dynamic-import/invalid-import-call-many-arguments.tree.json @@ -65,6 +65,7 @@ } } ], + "optional": false, "range": [ 0, 12 @@ -98,6 +99,7 @@ } } }, + "optional": false, "range": [ 0, 17 @@ -133,6 +135,7 @@ } } ], + "optional": false, "range": [ 0, 20 diff --git a/test/fixtures/es2018/dynamic-import/invalid-import-call-no-argument.tree.json b/test/fixtures/es2018/dynamic-import/invalid-import-call-no-argument.tree.json index 64ed2a7..f16eb71 100644 --- a/test/fixtures/es2018/dynamic-import/invalid-import-call-no-argument.tree.json +++ b/test/fixtures/es2018/dynamic-import/invalid-import-call-no-argument.tree.json @@ -28,6 +28,7 @@ } }, "arguments": [], + "optional": false, "range": [ 0, 8 @@ -61,6 +62,7 @@ } } }, + "optional": false, "range": [ 0, 13 @@ -96,6 +98,7 @@ } } ], + "optional": false, "range": [ 0, 21 diff --git a/test/fixtures/es2018/dynamic-import/loader-using-import.tree.json b/test/fixtures/es2018/dynamic-import/loader-using-import.tree.json index 408f408..eb7d45a 100644 --- a/test/fixtures/es2018/dynamic-import/loader-using-import.tree.json +++ b/test/fixtures/es2018/dynamic-import/loader-using-import.tree.json @@ -122,6 +122,7 @@ } } ], + "optional": false, "range": [ 26, 44 diff --git a/test/fixtures/es2018/for-await-of/invalid-for-await-of-not-async-context.failure.json b/test/fixtures/es2018/for-await-of/invalid-for-await-of-not-async-context.failure.json new file mode 100644 index 0000000..cec4e32 --- /dev/null +++ b/test/fixtures/es2018/for-await-of/invalid-for-await-of-not-async-context.failure.json @@ -0,0 +1 @@ +{"index":19,"lineNumber":1,"column":20,"message":"Error: Line 1: Unexpected identifier","description":"Unexpected identifier"} diff --git a/test/fixtures/es2018/for-await-of/invalid-for-await-of-not-async-context.js b/test/fixtures/es2018/for-await-of/invalid-for-await-of-not-async-context.js new file mode 100644 index 0000000..c61471b --- /dev/null +++ b/test/fixtures/es2018/for-await-of/invalid-for-await-of-not-async-context.js @@ -0,0 +1 @@ +function f() { for await (p of q); } diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-oct.js b/test/fixtures/es2018/template-literal-revision/not-escape-oct.js new file mode 100644 index 0000000..c5dc912 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/not-escape-oct.js @@ -0,0 +1 @@ +`\0YY` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-oct.tree.json b/test/fixtures/es2018/template-literal-revision/not-escape-oct.tree.json new file mode 100644 index 0000000..68dfaa8 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/not-escape-oct.tree.json @@ -0,0 +1,99 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "\\0YY", + "cooked": "\u0000YY" + }, + "tail": true, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "expressions": [], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "tokens": [ + { + "type": "Template", + "value": "`\\0YY`", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-oct.js b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-oct.js new file mode 100644 index 0000000..34f8fee --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-oct.js @@ -0,0 +1 @@ +a`\0YY` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-oct.tree.json b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-oct.tree.json new file mode 100644 index 0000000..a26ee85 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-oct.tree.json @@ -0,0 +1,152 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "TaggedTemplateExpression", + "tag": { + "type": "Identifier", + "name": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "quasi": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "\\0YY", + "cooked": "\u0000YY" + }, + "tail": true, + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "expressions": [], + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Template", + "value": "`\\0YY`", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-as-assignment-target.failure.json b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-as-assignment-target.failure.json new file mode 100644 index 0000000..cc6aa01 --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-as-assignment-target.failure.json @@ -0,0 +1 @@ +{"index":4,"lineNumber":1,"column":5,"message":"Error: Line 1: Invalid left-hand side in assignment","description":"Invalid left-hand side in assignment"} \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-as-assignment-target.js b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-as-assignment-target.js new file mode 100644 index 0000000..e2a9820 --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-as-assignment-target.js @@ -0,0 +1 @@ +a?.b = 1 \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-indirect-template-string.failure.json b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-indirect-template-string.failure.json new file mode 100644 index 0000000..41102f1 --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-indirect-template-string.failure.json @@ -0,0 +1 @@ +{"index":4,"lineNumber":1,"column":5,"message":"Error: Line 1: Invalid tagged template on optional chain","description":"Invalid tagged template on optional chain"} \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-indirect-template-string.js b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-indirect-template-string.js new file mode 100644 index 0000000..3c603b5 --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-indirect-template-string.js @@ -0,0 +1 @@ +a?.b`c` \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-indirect-template-string.failure.json b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-indirect-template-string.failure.json new file mode 100644 index 0000000..0ab1967 --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-indirect-template-string.failure.json @@ -0,0 +1 @@ +{"index":8,"lineNumber":1,"column":9,"message":"Error: Line 1: Invalid tagged template on optional chain","description":"Invalid tagged template on optional chain"} \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-indirect-template-string.js b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-indirect-template-string.js new file mode 100644 index 0000000..4d8a65b --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-indirect-template-string.js @@ -0,0 +1 @@ +new a?.b`c` \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-template-string.failure.json b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-template-string.failure.json new file mode 100644 index 0000000..ccfd9da --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-template-string.failure.json @@ -0,0 +1 @@ +{"index":7,"lineNumber":1,"column":8,"message":"Error: Line 1: Unexpected quasi b","description":"Unexpected quasi b"} \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-template-string.js b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-template-string.js new file mode 100644 index 0000000..58381d5 --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-template-string.js @@ -0,0 +1 @@ +new a?.`b` \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-template-string.failure.json b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-template-string.failure.json new file mode 100644 index 0000000..24cba19 --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-template-string.failure.json @@ -0,0 +1 @@ +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Unexpected quasi b","description":"Unexpected quasi b"} \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-template-string.js b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-template-string.js new file mode 100644 index 0000000..8cccd1f --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/invalid-optional-chaining-template-string.js @@ -0,0 +1 @@ +a?.`b` \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/optional-chaining-call.failure.json b/test/fixtures/es2020/optional-chaining/optional-chaining-call.failure.json new file mode 100644 index 0000000..a61c90d --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/optional-chaining-call.failure.json @@ -0,0 +1 @@ +{"index":27,"lineNumber":3,"column":8,"message":"Error: Line 3: Unexpected token (","description":"Unexpected token ("} \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/optional-chaining-call.js b/test/fixtures/es2020/optional-chaining/optional-chaining-call.js new file mode 100644 index 0000000..3d16c8d --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/optional-chaining-call.js @@ -0,0 +1,4 @@ +a?.().b.c +a.b?.().c +new a?.().b.c +new a.b?.().c \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/optional-chaining-computed-property.js b/test/fixtures/es2020/optional-chaining/optional-chaining-computed-property.js new file mode 100644 index 0000000..d7df54b --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/optional-chaining-computed-property.js @@ -0,0 +1,4 @@ +a?.['b'].c +a.b?.['c'] +new a?.['b'].c +new a.b?.['c'] \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/optional-chaining-computed-property.tree.json b/test/fixtures/es2020/optional-chaining/optional-chaining-computed-property.tree.json new file mode 100644 index 0000000..00e4547 --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/optional-chaining-computed-property.tree.json @@ -0,0 +1,1050 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ChainExpression", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "property": { + "type": "Literal", + "value": "b", + "raw": "'b'", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "optional": true, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "c", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "optional": false, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "ChainExpression", + "expression": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "property": { + "type": "Identifier", + "name": "b", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "optional": false, + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "property": { + "type": "Literal", + "value": "c", + "raw": "'c'", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "optional": true, + "range": [ + 11, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + "range": [ + 11, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "ChainExpression", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + "property": { + "type": "Literal", + "value": "b", + "raw": "'b'", + "range": [ + 30, + 33 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + "optional": true, + "range": [ + 26, + 34 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + "optional": false, + "range": [ + 26, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 14 + } + } + } + }, + "arguments": [], + "range": [ + 22, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + "range": [ + 22, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "ChainExpression", + "expression": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "b", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + "optional": false, + "range": [ + 41, + 44 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + "property": { + "type": "Literal", + "value": "c", + "raw": "'c'", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "optional": true, + "range": [ + 41, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 14 + } + } + } + }, + "arguments": [], + "range": [ + 37, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "range": [ + 37, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 14 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "?.", + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "String", + "value": "'b'", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "?.", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "String", + "value": "'c'", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "?.", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "String", + "value": "'b'", + "range": [ + 30, + 33 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 37, + 40 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "?.", + "range": [ + 44, + 46 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "String", + "value": "'c'", + "range": [ + 47, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/optional-chaining-static-property.js b/test/fixtures/es2020/optional-chaining/optional-chaining-static-property.js new file mode 100644 index 0000000..9efbe64 --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/optional-chaining-static-property.js @@ -0,0 +1,4 @@ +a?.b.c +a.b?.c +new a?.b.c +new a.b?.c \ No newline at end of file diff --git a/test/fixtures/es2020/optional-chaining/optional-chaining-static-property.tree.json b/test/fixtures/es2020/optional-chaining/optional-chaining-static-property.tree.json new file mode 100644 index 0000000..1fcf0c4 --- /dev/null +++ b/test/fixtures/es2020/optional-chaining/optional-chaining-static-property.tree.json @@ -0,0 +1,902 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ChainExpression", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "property": { + "type": "Identifier", + "name": "b", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "optional": true, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "property": { + "type": "Identifier", + "name": "c", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "optional": false, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "ChainExpression", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "property": { + "type": "Identifier", + "name": "b", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "optional": false, + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "c", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "optional": true, + "range": [ + 7, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + }, + "range": [ + 7, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "ChainExpression", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "b", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + "optional": true, + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "c", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "optional": false, + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + "arguments": [], + "range": [ + 14, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "range": [ + 14, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "ChainExpression", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "b", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + "optional": false, + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "c", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "optional": true, + "range": [ + 29, + 35 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + }, + "arguments": [], + "range": [ + 25, + 35 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "range": [ + 25, + 35 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "?.", + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "?.", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "?.", + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "?.", + "range": [ + 32, + 34 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/expression/binary/multiline_string.js b/test/fixtures/expression/binary/multiline_string.js index df03e16..9c9b550 100644 --- a/test/fixtures/expression/binary/multiline_string.js +++ b/test/fixtures/expression/binary/multiline_string.js @@ -1,2 +1,2 @@ '\ -' + bar \ No newline at end of file +' + bar diff --git a/test/fixtures/expression/binary/multiline_string.tree.json b/test/fixtures/expression/binary/multiline_string.tree.json index a09798e..1401fbb 100644 --- a/test/fixtures/expression/binary/multiline_string.tree.json +++ b/test/fixtures/expression/binary/multiline_string.tree.json @@ -145,4 +145,4 @@ "column": 7 } } -} \ No newline at end of file +} diff --git a/test/fixtures/expression/left-hand-side/let_object_computed.tree.json b/test/fixtures/expression/left-hand-side/let_object_computed.tree.json index 294cb43..2635c03 100644 --- a/test/fixtures/expression/left-hand-side/let_object_computed.tree.json +++ b/test/fixtures/expression/left-hand-side/let_object_computed.tree.json @@ -100,7 +100,8 @@ }, "type": "Identifier", "name": "foo" - } + }, + "optional": false }, "right": { "range": [ diff --git a/test/fixtures/expression/left-hand-side/migrated_0004.tree.json b/test/fixtures/expression/left-hand-side/migrated_0004.tree.json index 28178f2..c58290b 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0004.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0004.tree.json @@ -62,6 +62,7 @@ } } }, + "optional": false, "range": [ 0, 13 @@ -78,6 +79,7 @@ } }, "arguments": [], + "optional": false, "range": [ 0, 15 diff --git a/test/fixtures/expression/left-hand-side/migrated_0005.tree.json b/test/fixtures/expression/left-hand-side/migrated_0005.tree.json index 0d686dc..248a4b8 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0005.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0005.tree.json @@ -44,6 +44,7 @@ } } }, + "optional": false, "range": [ 4, 12 diff --git a/test/fixtures/expression/left-hand-side/migrated_0006.tree.json b/test/fixtures/expression/left-hand-side/migrated_0006.tree.json index 23bc184..2ff20b9 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0006.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0006.tree.json @@ -44,6 +44,7 @@ } } }, + "optional": false, "range": [ 4, 11 diff --git a/test/fixtures/expression/left-hand-side/migrated_0007.tree.json b/test/fixtures/expression/left-hand-side/migrated_0007.tree.json index dc0b65d..ce3b45f 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0007.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0007.tree.json @@ -62,6 +62,7 @@ } } }, + "optional": false, "range": [ 0, 14 @@ -78,6 +79,7 @@ } }, "arguments": [], + "optional": false, "range": [ 0, 16 diff --git a/test/fixtures/expression/left-hand-side/migrated_0008.tree.json b/test/fixtures/expression/left-hand-side/migrated_0008.tree.json index ad6b3c0..1251cef 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0008.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0008.tree.json @@ -61,6 +61,7 @@ } } ], + "optional": false, "range": [ 0, 13 diff --git a/test/fixtures/expression/left-hand-side/migrated_0009.tree.json b/test/fixtures/expression/left-hand-side/migrated_0009.tree.json index dbaa072..bf45cc0 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0009.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0009.tree.json @@ -24,6 +24,7 @@ } }, "arguments": [], + "optional": false, "range": [ 0, 13 diff --git a/test/fixtures/expression/left-hand-side/migrated_0010.tree.json b/test/fixtures/expression/left-hand-side/migrated_0010.tree.json index b79157f..5ba66f2 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0010.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0010.tree.json @@ -42,6 +42,7 @@ } } }, + "optional": false, "range": [ 0, 17 diff --git a/test/fixtures/expression/left-hand-side/migrated_0011.tree.json b/test/fixtures/expression/left-hand-side/migrated_0011.tree.json index ac93ae6..20e087a 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0011.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0011.tree.json @@ -45,6 +45,7 @@ } } }, + "optional": false, "range": [ 0, 17 @@ -78,6 +79,7 @@ } } }, + "optional": false, "range": [ 0, 29 diff --git a/test/fixtures/expression/left-hand-side/migrated_0012.tree.json b/test/fixtures/expression/left-hand-side/migrated_0012.tree.json index 8a8c5f2..703d3d3 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0012.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0012.tree.json @@ -48,6 +48,7 @@ } } }, + "optional": false, "range": [ 0, 17 @@ -81,6 +82,7 @@ } } }, + "optional": false, "range": [ 0, 29 @@ -114,6 +116,7 @@ } } }, + "optional": false, "range": [ 0, 35 diff --git a/test/fixtures/expression/left-hand-side/migrated_0013.tree.json b/test/fixtures/expression/left-hand-side/migrated_0013.tree.json index 14a9246..8bae0ee 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0013.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0013.tree.json @@ -79,6 +79,7 @@ } } }, + "optional": false, "range": [ 0, 38 diff --git a/test/fixtures/expression/left-hand-side/migrated_0014.tree.json b/test/fixtures/expression/left-hand-side/migrated_0014.tree.json index 961fc8f..4955170 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0014.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0014.tree.json @@ -42,6 +42,7 @@ } } }, + "optional": false, "range": [ 0, 20 diff --git a/test/fixtures/expression/left-hand-side/migrated_0015.tree.json b/test/fixtures/expression/left-hand-side/migrated_0015.tree.json index c3d0d05..500cf80 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0015.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0015.tree.json @@ -46,6 +46,7 @@ } } }, + "optional": false, "range": [ 0, 12 @@ -79,6 +80,7 @@ } } }, + "optional": false, "range": [ 0, 21 diff --git a/test/fixtures/expression/left-hand-side/migrated_0016.tree.json b/test/fixtures/expression/left-hand-side/migrated_0016.tree.json index 1779230..7014b54 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0016.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0016.tree.json @@ -47,6 +47,7 @@ } } ], + "optional": false, "range": [ 0, 12 @@ -80,6 +81,7 @@ } } }, + "optional": false, "range": [ 0, 21 diff --git a/test/fixtures/expression/left-hand-side/migrated_0017.tree.json b/test/fixtures/expression/left-hand-side/migrated_0017.tree.json index fc38836..f3525d7 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0017.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0017.tree.json @@ -52,6 +52,7 @@ } } ], + "optional": false, "range": [ 0, 12 @@ -85,6 +86,7 @@ } } }, + "optional": false, "range": [ 0, 21 @@ -159,6 +161,7 @@ } } ], + "optional": false, "range": [ 0, 32 @@ -192,6 +195,7 @@ } } }, + "optional": false, "range": [ 0, 41 diff --git a/test/fixtures/expression/left-hand-side/migrated_0018.tree.json b/test/fixtures/expression/left-hand-side/migrated_0018.tree.json index b6ae47a..3d0d2d2 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0018.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0018.tree.json @@ -50,6 +50,7 @@ } } }, + "optional": false, "range": [ 0, 10 @@ -83,6 +84,7 @@ } } }, + "optional": false, "range": [ 0, 20 @@ -116,6 +118,7 @@ } } }, + "optional": false, "range": [ 0, 39 @@ -152,6 +155,7 @@ } } ], + "optional": false, "range": [ 0, 45 diff --git a/test/fixtures/expression/left-hand-side/migrated_0019.tree.json b/test/fixtures/expression/left-hand-side/migrated_0019.tree.json index 169ec48..0900798 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0019.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0019.tree.json @@ -42,6 +42,7 @@ } } }, + "optional": false, "range": [ 0, 11 diff --git a/test/fixtures/expression/left-hand-side/migrated_0020.tree.json b/test/fixtures/expression/left-hand-side/migrated_0020.tree.json index 198f34b..0de7125 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0020.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0020.tree.json @@ -42,6 +42,7 @@ } } }, + "optional": false, "range": [ 0, 13 diff --git a/test/fixtures/expression/left-hand-side/migrated_0021.tree.json b/test/fixtures/expression/left-hand-side/migrated_0021.tree.json index 1d68470..241d593 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0021.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0021.tree.json @@ -42,6 +42,7 @@ } } }, + "optional": false, "range": [ 0, 14 diff --git a/test/fixtures/expression/left-hand-side/migrated_0022.tree.json b/test/fixtures/expression/left-hand-side/migrated_0022.tree.json index 13e3987..c9c9e5d 100644 --- a/test/fixtures/expression/left-hand-side/migrated_0022.tree.json +++ b/test/fixtures/expression/left-hand-side/migrated_0022.tree.json @@ -42,6 +42,7 @@ } } }, + "optional": false, "range": [ 0, 13 diff --git a/test/fixtures/expression/primary/literal/regular-expression/migrated_0005.tree.json b/test/fixtures/expression/primary/literal/regular-expression/migrated_0005.tree.json index fe3d161..5021740 100644 --- a/test/fixtures/expression/primary/literal/regular-expression/migrated_0005.tree.json +++ b/test/fixtures/expression/primary/literal/regular-expression/migrated_0005.tree.json @@ -26,7 +26,7 @@ }, "init": { "type": "Literal", - "value": {}, + "value": null, "raw": "/[\\u{0000000000000061}-\\u{7A}]/u", "regex": { "pattern": "[\\u{0000000000000061}-\\u{7A}]", diff --git a/test/fixtures/expression/primary/literal/regular-expression/migrated_0013.tree.json b/test/fixtures/expression/primary/literal/regular-expression/migrated_0013.tree.json index 56cf4b0..ab55372 100644 --- a/test/fixtures/expression/primary/literal/regular-expression/migrated_0013.tree.json +++ b/test/fixtures/expression/primary/literal/regular-expression/migrated_0013.tree.json @@ -68,6 +68,7 @@ } } }, + "optional": false, "range": [ 8, 18 diff --git a/test/fixtures/statement/block/migrated_0001.tree.json b/test/fixtures/statement/block/migrated_0001.tree.json index f2d2638..d4fb418 100644 --- a/test/fixtures/statement/block/migrated_0001.tree.json +++ b/test/fixtures/statement/block/migrated_0001.tree.json @@ -27,6 +27,7 @@ } }, "arguments": [], + "optional": false, "range": [ 2, 10 @@ -80,6 +81,7 @@ } }, "arguments": [], + "optional": false, "range": [ 12, 20 diff --git a/test/fixtures/statement/if/migrated_0000.tree.json b/test/fixtures/statement/if/migrated_0000.tree.json index 90d2e7c..e9c7c09 100644 --- a/test/fixtures/statement/if/migrated_0000.tree.json +++ b/test/fixtures/statement/if/migrated_0000.tree.json @@ -44,6 +44,7 @@ } }, "arguments": [], + "optional": false, "range": [ 13, 26 diff --git a/test/fixtures/statement/if/migrated_0004.tree.json b/test/fixtures/statement/if/migrated_0004.tree.json index 323780f..2da43a1 100644 --- a/test/fixtures/statement/if/migrated_0004.tree.json +++ b/test/fixtures/statement/if/migrated_0004.tree.json @@ -44,6 +44,7 @@ } }, "arguments": [], + "optional": false, "range": [ 13, 26 @@ -97,6 +98,7 @@ } }, "arguments": [], + "optional": false, "range": [ 33, 42 diff --git a/test/fixtures/statement/if/migrated_0005.tree.json b/test/fixtures/statement/if/migrated_0005.tree.json index 154bee1..d36bdd3 100644 --- a/test/fixtures/statement/if/migrated_0005.tree.json +++ b/test/fixtures/statement/if/migrated_0005.tree.json @@ -45,6 +45,7 @@ } }, "arguments": [], + "optional": false, "range": [ 10, 16 diff --git a/test/fixtures/statement/if/migrated_0006.tree.json b/test/fixtures/statement/if/migrated_0006.tree.json index ba07118..053469b 100644 --- a/test/fixtures/statement/if/migrated_0006.tree.json +++ b/test/fixtures/statement/if/migrated_0006.tree.json @@ -45,6 +45,7 @@ } }, "arguments": [], + "optional": false, "range": [ 10, 16 diff --git a/test/fixtures/statement/iteration/const_forin.tree.json b/test/fixtures/statement/iteration/const_forin.tree.json index 022d7a6..af6147c 100644 --- a/test/fixtures/statement/iteration/const_forin.tree.json +++ b/test/fixtures/statement/iteration/const_forin.tree.json @@ -119,6 +119,7 @@ } } ], + "optional": false, "range": [ 22, 32 diff --git a/test/fixtures/statement/iteration/migrated_0000.tree.json b/test/fixtures/statement/iteration/migrated_0000.tree.json index d6f36fa..08a4c92 100644 --- a/test/fixtures/statement/iteration/migrated_0000.tree.json +++ b/test/fixtures/statement/iteration/migrated_0000.tree.json @@ -26,6 +26,7 @@ } }, "arguments": [], + "optional": false, "range": [ 3, 9 diff --git a/test/fixtures/statement/iteration/migrated_0001.tree.json b/test/fixtures/statement/iteration/migrated_0001.tree.json index d66565c..bf3f3be 100644 --- a/test/fixtures/statement/iteration/migrated_0001.tree.json +++ b/test/fixtures/statement/iteration/migrated_0001.tree.json @@ -26,6 +26,7 @@ } }, "arguments": [], + "optional": false, "range": [ 3, 9 diff --git a/test/fixtures/statement/iteration/migrated_0004.tree.json b/test/fixtures/statement/iteration/migrated_0004.tree.json index 211a3a2..8c22cad 100644 --- a/test/fixtures/statement/iteration/migrated_0004.tree.json +++ b/test/fixtures/statement/iteration/migrated_0004.tree.json @@ -26,6 +26,7 @@ } }, "arguments": [], + "optional": false, "range": [ 3, 9 diff --git a/test/fixtures/statement/iteration/migrated_0005.tree.json b/test/fixtures/statement/iteration/migrated_0005.tree.json index 505dde0..aa11eec 100644 --- a/test/fixtures/statement/iteration/migrated_0005.tree.json +++ b/test/fixtures/statement/iteration/migrated_0005.tree.json @@ -26,6 +26,7 @@ } }, "arguments": [], + "optional": false, "range": [ 3, 9 diff --git a/test/fixtures/statement/iteration/migrated_0006.tree.json b/test/fixtures/statement/iteration/migrated_0006.tree.json index 92897d2..4046e66 100644 --- a/test/fixtures/statement/iteration/migrated_0006.tree.json +++ b/test/fixtures/statement/iteration/migrated_0006.tree.json @@ -45,6 +45,7 @@ } }, "arguments": [], + "optional": false, "range": [ 13, 26 diff --git a/test/fixtures/statement/iteration/migrated_0016.tree.json b/test/fixtures/statement/iteration/migrated_0016.tree.json index 8cfec25..678a93c 100644 --- a/test/fixtures/statement/iteration/migrated_0016.tree.json +++ b/test/fixtures/statement/iteration/migrated_0016.tree.json @@ -192,6 +192,7 @@ } } ], + "optional": false, "range": [ 24, 34 diff --git a/test/fixtures/statement/iteration/migrated_0017.tree.json b/test/fixtures/statement/iteration/migrated_0017.tree.json index f61b150..fa54397 100644 --- a/test/fixtures/statement/iteration/migrated_0017.tree.json +++ b/test/fixtures/statement/iteration/migrated_0017.tree.json @@ -81,6 +81,7 @@ } } ], + "optional": false, "range": [ 15, 25 diff --git a/test/fixtures/statement/iteration/migrated_0018.tree.json b/test/fixtures/statement/iteration/migrated_0018.tree.json index a2944c7..ee9e7bb 100644 --- a/test/fixtures/statement/iteration/migrated_0018.tree.json +++ b/test/fixtures/statement/iteration/migrated_0018.tree.json @@ -119,6 +119,7 @@ } } ], + "optional": false, "range": [ 20, 30 diff --git a/test/fixtures/statement/iteration/migrated_0019.tree.json b/test/fixtures/statement/iteration/migrated_0019.tree.json index e8d1f60..4917a55 100644 --- a/test/fixtures/statement/iteration/migrated_0019.tree.json +++ b/test/fixtures/statement/iteration/migrated_0019.tree.json @@ -137,6 +137,7 @@ } } ], + "optional": false, "range": [ 25, 35 diff --git a/test/fixtures/statement/iteration/migrated_0020.tree.json b/test/fixtures/statement/iteration/migrated_0020.tree.json index a05a0bb..fab216e 100644 --- a/test/fixtures/statement/iteration/migrated_0020.tree.json +++ b/test/fixtures/statement/iteration/migrated_0020.tree.json @@ -119,6 +119,7 @@ } } ], + "optional": false, "range": [ 20, 30 diff --git a/test/fixtures/statement/iteration/migrated_0023.tree.json b/test/fixtures/statement/iteration/migrated_0023.tree.json index ec41fdf..c4a643b 100644 --- a/test/fixtures/statement/iteration/migrated_0023.tree.json +++ b/test/fixtures/statement/iteration/migrated_0023.tree.json @@ -231,6 +231,7 @@ } } ], + "optional": false, "range": [ 53, 63 diff --git a/test/fixtures/statement/iteration/migrated_0024.tree.json b/test/fixtures/statement/iteration/migrated_0024.tree.json index c143217..b5e2c2b 100644 --- a/test/fixtures/statement/iteration/migrated_0024.tree.json +++ b/test/fixtures/statement/iteration/migrated_0024.tree.json @@ -78,6 +78,7 @@ } } }, + "optional": false, "range": [ 5, 14 diff --git a/test/fixtures/statement/iteration/migrated_0025.tree.json b/test/fixtures/statement/iteration/migrated_0025.tree.json index b3d4e4c..989bc7e 100644 --- a/test/fixtures/statement/iteration/migrated_0025.tree.json +++ b/test/fixtures/statement/iteration/migrated_0025.tree.json @@ -82,6 +82,7 @@ } } ], + "optional": false, "range": [ 5, 14 @@ -116,6 +117,7 @@ } } }, + "optional": false, "range": [ 5, 17 diff --git a/test/fixtures/statement/iteration/migrated_0026.tree.json b/test/fixtures/statement/iteration/migrated_0026.tree.json index 47239c3..64dd5b6 100644 --- a/test/fixtures/statement/iteration/migrated_0026.tree.json +++ b/test/fixtures/statement/iteration/migrated_0026.tree.json @@ -42,6 +42,7 @@ } } }, + "optional": false, "range": [ 5, 9 diff --git a/test/fixtures/statement/iteration/pattern-in-for-in.tree.json b/test/fixtures/statement/iteration/pattern-in-for-in.tree.json index 6d7bf07..bf4cae1 100644 --- a/test/fixtures/statement/iteration/pattern-in-for-in.tree.json +++ b/test/fixtures/statement/iteration/pattern-in-for-in.tree.json @@ -104,7 +104,8 @@ }, "type": "Identifier", "name": "a" - } + }, + "optional": false }, { "range": [ @@ -393,7 +394,8 @@ "type": "Identifier", "name": "h" }, - "arguments": [] + "arguments": [], + "optional": false }, "property": { "range": [ @@ -412,7 +414,8 @@ }, "type": "Identifier", "name": "a" - } + }, + "optional": false }, { "range": [ @@ -467,7 +470,8 @@ }, "type": "Identifier", "name": "k" - } + }, + "optional": false }, { "range": [ @@ -538,7 +542,8 @@ "type": "Literal", "value": 0, "raw": "0" - } + }, + "optional": false } } ] diff --git a/test/fixtures/statement/switch/migrated_0001.tree.json b/test/fixtures/statement/switch/migrated_0001.tree.json index 9f46287..f542af5 100644 --- a/test/fixtures/statement/switch/migrated_0001.tree.json +++ b/test/fixtures/statement/switch/migrated_0001.tree.json @@ -67,6 +67,7 @@ } }, "arguments": [], + "optional": false, "range": [ 27, 31 diff --git a/test/fixtures/statement/switch/migrated_0002.tree.json b/test/fixtures/statement/switch/migrated_0002.tree.json index 69b351b..00adb0b 100644 --- a/test/fixtures/statement/switch/migrated_0002.tree.json +++ b/test/fixtures/statement/switch/migrated_0002.tree.json @@ -67,6 +67,7 @@ } }, "arguments": [], + "optional": false, "range": [ 27, 31 diff --git a/test/fixtures/statement/try/migrated_0003.tree.json b/test/fixtures/statement/try/migrated_0003.tree.json index f7f2cdf..c86daa8 100644 --- a/test/fixtures/statement/try/migrated_0003.tree.json +++ b/test/fixtures/statement/try/migrated_0003.tree.json @@ -86,6 +86,7 @@ } } ], + "optional": false, "range": [ 20, 26 diff --git a/test/fixtures/statement/try/migrated_0004.tree.json b/test/fixtures/statement/try/migrated_0004.tree.json index 29982e7..99b8b1f 100644 --- a/test/fixtures/statement/try/migrated_0004.tree.json +++ b/test/fixtures/statement/try/migrated_0004.tree.json @@ -67,6 +67,7 @@ } } ], + "optional": false, "range": [ 18, 32 diff --git a/test/fixtures/statement/try/migrated_0005.tree.json b/test/fixtures/statement/try/migrated_0005.tree.json index ec7f137..6120085 100644 --- a/test/fixtures/statement/try/migrated_0005.tree.json +++ b/test/fixtures/statement/try/migrated_0005.tree.json @@ -29,6 +29,7 @@ } }, "arguments": [], + "optional": false, "range": [ 6, 14 @@ -140,6 +141,7 @@ } } ], + "optional": false, "range": [ 30, 36 diff --git a/test/fixtures/statement/try/migrated_0006.tree.json b/test/fixtures/statement/try/migrated_0006.tree.json index a67b562..24c0aa9 100644 --- a/test/fixtures/statement/try/migrated_0006.tree.json +++ b/test/fixtures/statement/try/migrated_0006.tree.json @@ -29,6 +29,7 @@ } }, "arguments": [], + "optional": false, "range": [ 6, 14 @@ -140,6 +141,7 @@ } } ], + "optional": false, "range": [ 30, 36 @@ -246,6 +248,7 @@ } } ], + "optional": false, "range": [ 49, 63 diff --git a/test/fixtures/tolerant-parse/migrated_0005.tree.json b/test/fixtures/tolerant-parse/migrated_0005.tree.json index 7e7f3a4..96f8d60 100644 --- a/test/fixtures/tolerant-parse/migrated_0005.tree.json +++ b/test/fixtures/tolerant-parse/migrated_0005.tree.json @@ -79,6 +79,7 @@ } } ], + "optional": false, "range": [ 0, 8 diff --git a/test/fixtures/tolerant-parse/migrated_0006.tree.json b/test/fixtures/tolerant-parse/migrated_0006.tree.json index bc895ac..39b8c35 100644 --- a/test/fixtures/tolerant-parse/migrated_0006.tree.json +++ b/test/fixtures/tolerant-parse/migrated_0006.tree.json @@ -101,6 +101,7 @@ } } ], + "optional": false, "range": [ 0, 19 diff --git a/test/fixtures/tolerant-parse/migrated_0007.tree.json b/test/fixtures/tolerant-parse/migrated_0007.tree.json index 8be0118..d8db967 100644 --- a/test/fixtures/tolerant-parse/migrated_0007.tree.json +++ b/test/fixtures/tolerant-parse/migrated_0007.tree.json @@ -79,6 +79,7 @@ } } ], + "optional": false, "range": [ 0, 9 diff --git a/test/fixtures/tolerant-parse/migrated_0014.tree.json b/test/fixtures/tolerant-parse/migrated_0014.tree.json index 3d87442..b1d3fed 100644 --- a/test/fixtures/tolerant-parse/migrated_0014.tree.json +++ b/test/fixtures/tolerant-parse/migrated_0014.tree.json @@ -136,6 +136,7 @@ } }, "arguments": [], + "optional": false, "range": [ 1, 42 diff --git a/test/fixtures/tolerant-parse/migrated_0015.tree.json b/test/fixtures/tolerant-parse/migrated_0015.tree.json index 9cf6a69..c74e115 100644 --- a/test/fixtures/tolerant-parse/migrated_0015.tree.json +++ b/test/fixtures/tolerant-parse/migrated_0015.tree.json @@ -120,6 +120,7 @@ } }, "arguments": [], + "optional": false, "range": [ 1, 36 diff --git a/test/fixtures/tolerant-parse/migrated_0044.tree.json b/test/fixtures/tolerant-parse/migrated_0044.tree.json index 44675a0..4adfd32 100644 --- a/test/fixtures/tolerant-parse/migrated_0044.tree.json +++ b/test/fixtures/tolerant-parse/migrated_0044.tree.json @@ -47,6 +47,7 @@ } } ], + "optional": false, "range": [ 0, 10