From 442a3edb39c1e2b9923972fe0ff44a83a695ff36 Mon Sep 17 00:00:00 2001 From: Jeremy Mill Date: Mon, 24 May 2021 08:53:37 -0400 Subject: [PATCH 1/8] update messages and nodes --- esprima/messages.py | 1 + esprima/nodes.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) 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): From 76ea07af92604383b40be962072103601ec84c44 Mon Sep 17 00:00:00 2001 From: Jeremy Mill Date: Mon, 24 May 2021 09:17:04 -0400 Subject: [PATCH 2/8] update parser.py --- esprima/parser.py | 71 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/esprima/parser.py b/esprima/parser.py index 2309e7b..0efd2e6 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 optional: + 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 From d1aa2401131d2caca79be18c19c690dbf4e7e3d5 Mon Sep 17 00:00:00 2001 From: Jeremy Mill Date: Mon, 24 May 2021 09:29:34 -0400 Subject: [PATCH 3/8] optional chaining support in scanner --- esprima/scanner.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/esprima/scanner.py b/esprima/scanner.py index 53502a5..6260361 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 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 From 7910128d6028c46e4e3280d849753fd96f415652 Mon Sep 17 00:00:00 2001 From: Jeremy Mill Date: Mon, 24 May 2021 09:30:26 -0400 Subject: [PATCH 4/8] add ChainExpression to syntax --- esprima/syntax.py | 1 + 1 file changed, 1 insertion(+) 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" From 65299b5a5b50ae9b817bd1e981896fc5f222b89b Mon Sep 17 00:00:00 2001 From: Jeremy Mill Date: Mon, 24 May 2021 10:17:21 -0400 Subject: [PATCH 5/8] migrate tests from esprima to esprima-python --- .../arrow-function/migrated_0018.tree.json | 1 + .../arrow-function/migrated_0019.tree.json | 1 + .../member-expr-in-rest.tree.json | 3 +- .../array-pattern/nested-assignment.tree.json | 3 +- .../nested-cover-grammar.tree.json | 3 +- .../object-pattern-assignment.tree.json | 9 +- .../for-of/for-of-array-pattern-let.tree.json | 1 + .../for-of/for-of-array-pattern-var.tree.json | 1 + .../ES6/for-of/for-of-array-pattern.tree.json | 1 + test/fixtures/ES6/for-of/for-of-let.tree.json | 1 + .../for-of-object-pattern-const.tree.json | 1 + .../for-of-object-pattern-var.tree.json | 1 + .../for-of/for-of-object-pattern.tree.json | 1 + .../ES6/for-of/for-of-with-const.tree.json | 1 + .../ES6/for-of/for-of-with-let.tree.json | 1 + .../ES6/for-of/for-of-with-var.tree.json | 1 + test/fixtures/ES6/for-of/for-of.tree.json | 1 + test/fixtures/ES6/for-of/let-of-of.tree.json | 1 + .../lexical-declaration/let_member.tree.json | 3 +- .../meta-property/new-target-invoke.tree.json | 3 +- .../new-target-precedence.tree.json | 3 +- .../call-multi-spread.tree.json | 3 +- .../call-spread-default.tree.json | 11 +- .../call-spread-first.tree.json | 3 +- .../call-spread-number.tree.json | 3 +- .../ES6/spread-element/call-spread.tree.json | 3 +- .../ES6/super-property/arrow_super.tree.json | 5 +- .../constructor_super.tree.json | 3 +- .../ES6/super-property/new_super.tree.json | 3 +- .../super-property/super_computed.tree.json | 3 +- .../ES6/super-property/super_member.tree.json | 3 +- .../invalid-escape.failure.json | 2 +- .../invalid-hex-escape-sequence.failure.json | 2 +- .../literal-escape-sequences.source.js | 2 +- .../literal-escape-sequences.tree.json | 26 +- .../nested-function-with-object-pattern.js | 1 + ...ted-function-with-object-pattern.tree.json | 528 +++++++++ .../octal-literal.failure.json | 2 +- .../strict-octal-literal.failure.json | 2 +- .../ES6/yield/invalid-yield-object-methods.js | 2 +- .../invalid-yield-object-methods.tree.json | 2 +- .../invalid-yield-object-property-getter.js | 2 +- ...lid-yield-object-property-getter.tree.json | 2 +- .../invalid-yield-object-property-setter.js | 2 +- ...lid-yield-object-property-setter.tree.json | 2 +- .../ES6/yield/yield-arg-super.tree.json | 2 + .../yield-call-expression-property.tree.json | 6 +- ...yield-member-expression-property.tree.json | 3 +- .../ES6/yield/yield-super-property.tree.json | 3 +- test/fixtures/ESnext/classProperties.js | 1 - .../fixtures/ESnext/classProperties.tree.json | 51 - test/fixtures/JSX/fragment-with-child.js | 1 + .../JSX/fragment-with-child.tree.json | 311 +++++ test/fixtures/JSX/fragment-with-children.js | 1 + .../JSX/fragment-with-children.tree.json | 618 ++++++++++ test/fixtures/JSX/fragment.js | 1 + test/fixtures/JSX/fragment.tree.json | 182 +++ .../JSX/invalid-fragment-tag.failure.json | 1 + test/fixtures/JSX/invalid-fragment-tag.js | 1 + .../JSX/invalid-fragment.failure.json | 1 + test/fixtures/JSX/invalid-fragment.js | 1 + test/fixtures/comment/migrated_0027.tree.json | 1 + test/fixtures/comment/migrated_0028.tree.json | 1 + test/fixtures/comment/migrated_0029.tree.json | 1 + test/fixtures/comment/migrated_0030.tree.json | 1 + test/fixtures/comment/migrated_0031.tree.json | 1 + test/fixtures/comment/migrated_0032.tree.json | 1 + test/fixtures/comment/migrated_0033.tree.json | 2 + test/fixtures/comment/migrated_0034.tree.json | 2 + .../function/migrated_0000.tree.json | 1 + .../function/migrated_0006.tree.json | 1 + .../function/migrated_0007.tree.json | 1 + .../function/migrated_0008.tree.json | 1 + .../function/migrated_0011.tree.json | 1 + .../directive-prolog/migrated_0000.tree.json | 1 + .../directive-prolog/migrated_0001.tree.json | 1 + .../async-arrow-as-last-parameter.tree.json | 1 + .../arrows/async-arrow-as-parameter.tree.json | 1 + ...gument-async-function-expression.tree.json | 1 + ...function-expression-as-parameter.tree.json | 1 + .../class-async-method-computed.tree.json | 2 +- .../argument-async-call.tree.json | 2 + .../call-async-await.tree.json | 1 + .../regular-identifier/call-async.tree.json | 1 + .../trailing-comma-call.tree.json | 1 + .../trailing-comma-spread.tree.json | 1 + .../dynamic-import/await-import.tree.json | 1 + ...t-call-import-declaration.module.tree.json | 3 + .../import-call-string.tree.json | 3 + .../import-call-template.tree.json | 3 + .../dynamic-import/import-call-var.tree.json | 3 + ...valid-import-call-many-arguments.tree.json | 3 + .../invalid-import-call-no-argument.tree.json | 3 + .../loader-using-import.tree.json | 1 + .../es2018/for-await-of/for-await-of.js | 1 + .../for-await-of/for-await-of.tree.json | 421 +++++++ ...or-await-of-not-async-context.failure.json | 1 + .../invalid-for-await-of-not-async-context.js | 1 + .../not-escape-8.failure.json | 1 + .../template-literal-revision/not-escape-8.js | 1 + .../not-escape-9.failure.json | 1 + .../template-literal-revision/not-escape-9.js | 1 + .../not-escape-hex.failure.json | 1 + .../not-escape-hex.js | 1 + .../not-escape-oct.js | 1 + .../not-escape-oct.tree.json | 99 ++ ...not-escape-unicode-code-point.failure.json | 1 + .../not-escape-unicode-code-point.js | 1 + .../not-escape-unicode.failure.json | 1 + .../not-escape-unicode.js | 1 + .../span-not-escape-unicode.failure.json | 1 + .../span-not-escape-unicode.js | 1 + .../tagged-not-escape-8.js | 1 + .../tagged-not-escape-8.tree.json | 152 +++ .../tagged-not-escape-9.js | 1 + .../tagged-not-escape-9.tree.json | 152 +++ .../tagged-not-escape-hex.js | 1 + .../tagged-not-escape-hex.tree.json | 152 +++ .../tagged-not-escape-oct.js | 1 + .../tagged-not-escape-oct.tree.json | 152 +++ .../tagged-not-escape-unicode-code-point.js | 1 + ...ed-not-escape-unicode-code-point.tree.json | 152 +++ .../tagged-not-escape-unicode.js | 1 + .../tagged-not-escape-unicode.tree.json | 152 +++ .../optional-catch-binding.js | 1 + .../optional-catch-binding.tree.json | 202 ++++ ...ish-coalescing-chain-and-head.failure.json | 1 + ...valid-nullish-coalescing-chain-and-head.js | 1 + ...ish-coalescing-chain-and-tail.failure.json | 1 + ...valid-nullish-coalescing-chain-and-tail.js | 1 + ...lish-coalescing-chain-or-tail.failure.json | 1 + ...nvalid-nullish-coalescing-chain-or-tail.js | 1 + ...chaining-as-assignment-target.failure.json | 1 + ...-optional-chaining-as-assignment-target.js | 1 + ...ning-indirect-template-string.failure.json | 1 + ...ional-chaining-indirect-template-string.js | 1 + ...-new-indirect-template-string.failure.json | 1 + ...l-chaining-new-indirect-template-string.js | 1 + ...-chaining-new-template-string.failure.json | 1 + ...d-optional-chaining-new-template-string.js | 1 + ...onal-chaining-template-string.failure.json | 1 + ...valid-optional-chaining-template-string.js | 1 + .../optional-chaining-call.failure.json | 1 + .../optional-chaining-call.js | 4 + .../optional-chaining-computed-property.js | 4 + ...ional-chaining-computed-property.tree.json | 1050 +++++++++++++++++ .../optional-chaining-static-property.js | 4 + ...ptional-chaining-static-property.tree.json | 902 ++++++++++++++ .../expression/binary/multiline_string.js | 2 +- .../binary/multiline_string.tree.json | 2 +- .../binary/multiline_string_literal.js | 3 + .../binary/multiline_string_literal.tree.json | 332 ++++++ .../let_object_computed.tree.json | 3 +- .../left-hand-side/migrated_0004.tree.json | 2 + .../left-hand-side/migrated_0005.tree.json | 1 + .../left-hand-side/migrated_0006.tree.json | 1 + .../left-hand-side/migrated_0007.tree.json | 2 + .../left-hand-side/migrated_0008.tree.json | 1 + .../left-hand-side/migrated_0009.tree.json | 1 + .../left-hand-side/migrated_0010.tree.json | 1 + .../left-hand-side/migrated_0011.tree.json | 2 + .../left-hand-side/migrated_0012.tree.json | 3 + .../left-hand-side/migrated_0013.tree.json | 1 + .../left-hand-side/migrated_0014.tree.json | 1 + .../left-hand-side/migrated_0015.tree.json | 2 + .../left-hand-side/migrated_0016.tree.json | 2 + .../left-hand-side/migrated_0017.tree.json | 4 + .../left-hand-side/migrated_0018.tree.json | 4 + .../left-hand-side/migrated_0019.tree.json | 1 + .../left-hand-side/migrated_0020.tree.json | 1 + .../left-hand-side/migrated_0021.tree.json | 1 + .../left-hand-side/migrated_0022.tree.json | 1 + .../migrated_0005.tree.json | 2 +- .../migrated_0013.tree.json | 1 + .../u-flag-valid-range.tree.json | 2 +- .../statement/block/migrated_0001.tree.json | 2 + .../else-declaration-following-classic-for.js | 6 + ...eclaration-following-classic-for.tree.json | 600 ++++++++++ .../statement/if/migrated_0000.tree.json | 1 + .../statement/if/migrated_0004.tree.json | 2 + .../statement/if/migrated_0005.tree.json | 1 + .../statement/if/migrated_0006.tree.json | 1 + .../statement/iteration/const_forin.tree.json | 1 + .../iteration/migrated_0000.tree.json | 1 + .../iteration/migrated_0001.tree.json | 1 + .../iteration/migrated_0004.tree.json | 1 + .../iteration/migrated_0005.tree.json | 1 + .../iteration/migrated_0006.tree.json | 1 + .../iteration/migrated_0016.tree.json | 1 + .../iteration/migrated_0017.tree.json | 1 + .../iteration/migrated_0018.tree.json | 1 + .../iteration/migrated_0019.tree.json | 1 + .../iteration/migrated_0020.tree.json | 1 + .../iteration/migrated_0023.tree.json | 1 + .../iteration/migrated_0024.tree.json | 1 + .../iteration/migrated_0025.tree.json | 2 + .../iteration/migrated_0026.tree.json | 1 + .../iteration/pattern-in-for-in.tree.json | 15 +- .../statement/switch/migrated_0001.tree.json | 1 + .../statement/switch/migrated_0002.tree.json | 1 + .../statement/try/migrated_0003.tree.json | 1 + .../statement/try/migrated_0004.tree.json | 1 + .../statement/try/migrated_0005.tree.json | 2 + .../statement/try/migrated_0006.tree.json | 3 + .../for-of-missing-parenthesis.tree.json | 1 + .../tolerant-parse/migrated_0005.tree.json | 1 + .../tolerant-parse/migrated_0006.tree.json | 1 + .../tolerant-parse/migrated_0007.tree.json | 1 + .../tolerant-parse/migrated_0014.tree.json | 1 + .../tolerant-parse/migrated_0015.tree.json | 1 + .../tolerant-parse/migrated_0044.tree.json | 1 + 211 files changed, 6453 insertions(+), 115 deletions(-) create mode 100644 test/fixtures/ES6/template-literals/nested-function-with-object-pattern.js create mode 100644 test/fixtures/ES6/template-literals/nested-function-with-object-pattern.tree.json delete mode 100644 test/fixtures/ESnext/classProperties.js delete mode 100644 test/fixtures/ESnext/classProperties.tree.json create mode 100644 test/fixtures/JSX/fragment-with-child.js create mode 100644 test/fixtures/JSX/fragment-with-child.tree.json create mode 100644 test/fixtures/JSX/fragment-with-children.js create mode 100644 test/fixtures/JSX/fragment-with-children.tree.json create mode 100644 test/fixtures/JSX/fragment.js create mode 100644 test/fixtures/JSX/fragment.tree.json create mode 100644 test/fixtures/JSX/invalid-fragment-tag.failure.json create mode 100644 test/fixtures/JSX/invalid-fragment-tag.js create mode 100644 test/fixtures/JSX/invalid-fragment.failure.json create mode 100644 test/fixtures/JSX/invalid-fragment.js create mode 100644 test/fixtures/es2018/for-await-of/for-await-of.js create mode 100644 test/fixtures/es2018/for-await-of/for-await-of.tree.json create mode 100644 test/fixtures/es2018/for-await-of/invalid-for-await-of-not-async-context.failure.json create mode 100644 test/fixtures/es2018/for-await-of/invalid-for-await-of-not-async-context.js create mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-8.failure.json create mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-8.js create mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-9.failure.json create mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-9.js create mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-hex.failure.json create mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-hex.js create mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-oct.js create mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-oct.tree.json create mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.failure.json create mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.js create mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-unicode.failure.json create mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-unicode.js create mode 100644 test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.failure.json create mode 100644 test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.js create mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.js create mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.tree.json create mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.js create mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.tree.json create mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.js create mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.tree.json create mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-oct.js create mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-oct.tree.json create mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.js create mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.tree.json create mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.js create mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.tree.json create mode 100644 test/fixtures/es2019/optional-catch-binding/optional-catch-binding.js create mode 100644 test/fixtures/es2019/optional-catch-binding/optional-catch-binding.tree.json create mode 100644 test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.failure.json create mode 100644 test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.js create mode 100644 test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.failure.json create mode 100644 test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.js create mode 100644 test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.failure.json create mode 100644 test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.js create mode 100644 test/fixtures/es2020/optional-chaining/invalid-optional-chaining-as-assignment-target.failure.json create mode 100644 test/fixtures/es2020/optional-chaining/invalid-optional-chaining-as-assignment-target.js create mode 100644 test/fixtures/es2020/optional-chaining/invalid-optional-chaining-indirect-template-string.failure.json create mode 100644 test/fixtures/es2020/optional-chaining/invalid-optional-chaining-indirect-template-string.js create mode 100644 test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-indirect-template-string.failure.json create mode 100644 test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-indirect-template-string.js create mode 100644 test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-template-string.failure.json create mode 100644 test/fixtures/es2020/optional-chaining/invalid-optional-chaining-new-template-string.js create mode 100644 test/fixtures/es2020/optional-chaining/invalid-optional-chaining-template-string.failure.json create mode 100644 test/fixtures/es2020/optional-chaining/invalid-optional-chaining-template-string.js create mode 100644 test/fixtures/es2020/optional-chaining/optional-chaining-call.failure.json create mode 100644 test/fixtures/es2020/optional-chaining/optional-chaining-call.js create mode 100644 test/fixtures/es2020/optional-chaining/optional-chaining-computed-property.js create mode 100644 test/fixtures/es2020/optional-chaining/optional-chaining-computed-property.tree.json create mode 100644 test/fixtures/es2020/optional-chaining/optional-chaining-static-property.js create mode 100644 test/fixtures/es2020/optional-chaining/optional-chaining-static-property.tree.json create mode 100644 test/fixtures/expression/binary/multiline_string_literal.js create mode 100644 test/fixtures/expression/binary/multiline_string_literal.tree.json create mode 100644 test/fixtures/statement/if/else-declaration-following-classic-for.js create mode 100644 test/fixtures/statement/if/else-declaration-following-classic-for.tree.json 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/for-of/for-of-array-pattern-let.tree.json b/test/fixtures/ES6/for-of/for-of-array-pattern-let.tree.json index 419164e..74b307e 100644 --- a/test/fixtures/ES6/for-of/for-of-array-pattern-let.tree.json +++ b/test/fixtures/ES6/for-of/for-of-array-pattern-let.tree.json @@ -17,6 +17,7 @@ } }, "type": "ForOfStatement", + "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-array-pattern-var.tree.json b/test/fixtures/ES6/for-of/for-of-array-pattern-var.tree.json index dbb3799..d3838b7 100644 --- a/test/fixtures/ES6/for-of/for-of-array-pattern-var.tree.json +++ b/test/fixtures/ES6/for-of/for-of-array-pattern-var.tree.json @@ -17,6 +17,7 @@ } }, "type": "ForOfStatement", + "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-array-pattern.tree.json b/test/fixtures/ES6/for-of/for-of-array-pattern.tree.json index 9a7b8fa..e2311f0 100644 --- a/test/fixtures/ES6/for-of/for-of-array-pattern.tree.json +++ b/test/fixtures/ES6/for-of/for-of-array-pattern.tree.json @@ -17,6 +17,7 @@ } }, "type": "ForOfStatement", + "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-let.tree.json b/test/fixtures/ES6/for-of/for-of-let.tree.json index 797bd0e..5202be9 100644 --- a/test/fixtures/ES6/for-of/for-of-let.tree.json +++ b/test/fixtures/ES6/for-of/for-of-let.tree.json @@ -31,6 +31,7 @@ } }, "type": "ForOfStatement", + "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-object-pattern-const.tree.json b/test/fixtures/ES6/for-of/for-of-object-pattern-const.tree.json index 8cc1ea2..a1bcb25 100644 --- a/test/fixtures/ES6/for-of/for-of-object-pattern-const.tree.json +++ b/test/fixtures/ES6/for-of/for-of-object-pattern-const.tree.json @@ -17,6 +17,7 @@ } }, "type": "ForOfStatement", + "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-object-pattern-var.tree.json b/test/fixtures/ES6/for-of/for-of-object-pattern-var.tree.json index 5e4d9a4..0bfd049 100644 --- a/test/fixtures/ES6/for-of/for-of-object-pattern-var.tree.json +++ b/test/fixtures/ES6/for-of/for-of-object-pattern-var.tree.json @@ -17,6 +17,7 @@ } }, "type": "ForOfStatement", + "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-object-pattern.tree.json b/test/fixtures/ES6/for-of/for-of-object-pattern.tree.json index 5b4fd7a..a3e9917 100644 --- a/test/fixtures/ES6/for-of/for-of-object-pattern.tree.json +++ b/test/fixtures/ES6/for-of/for-of-object-pattern.tree.json @@ -17,6 +17,7 @@ } }, "type": "ForOfStatement", + "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-with-const.tree.json b/test/fixtures/ES6/for-of/for-of-with-const.tree.json index a0d5ed7..83248e4 100644 --- a/test/fixtures/ES6/for-of/for-of-with-const.tree.json +++ b/test/fixtures/ES6/for-of/for-of-with-const.tree.json @@ -17,6 +17,7 @@ } }, "type": "ForOfStatement", + "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-with-let.tree.json b/test/fixtures/ES6/for-of/for-of-with-let.tree.json index 6dc117b..c845a0d 100644 --- a/test/fixtures/ES6/for-of/for-of-with-let.tree.json +++ b/test/fixtures/ES6/for-of/for-of-with-let.tree.json @@ -17,6 +17,7 @@ } }, "type": "ForOfStatement", + "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-with-var.tree.json b/test/fixtures/ES6/for-of/for-of-with-var.tree.json index a4b4100..a926d36 100644 --- a/test/fixtures/ES6/for-of/for-of-with-var.tree.json +++ b/test/fixtures/ES6/for-of/for-of-with-var.tree.json @@ -17,6 +17,7 @@ } }, "type": "ForOfStatement", + "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of.tree.json b/test/fixtures/ES6/for-of/for-of.tree.json index 83dbb37..46c086c 100644 --- a/test/fixtures/ES6/for-of/for-of.tree.json +++ b/test/fixtures/ES6/for-of/for-of.tree.json @@ -17,6 +17,7 @@ } }, "type": "ForOfStatement", + "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/let-of-of.tree.json b/test/fixtures/ES6/for-of/let-of-of.tree.json index 7e0abdb..6c3e2cb 100644 --- a/test/fixtures/ES6/for-of/let-of-of.tree.json +++ b/test/fixtures/ES6/for-of/let-of-of.tree.json @@ -17,6 +17,7 @@ } }, "type": "ForOfStatement", + "await": false, "left": { "range": [ 5, 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-escape.failure.json b/test/fixtures/ES6/template-literals/invalid-escape.failure.json index 658b44d..186ee5e 100644 --- a/test/fixtures/ES6/template-literals/invalid-escape.failure.json +++ b/test/fixtures/ES6/template-literals/invalid-escape.failure.json @@ -1 +1 @@ -{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file +{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file 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/template-literals/nested-function-with-object-pattern.js b/test/fixtures/ES6/template-literals/nested-function-with-object-pattern.js new file mode 100644 index 0000000..8314cd4 --- /dev/null +++ b/test/fixtures/ES6/template-literals/nested-function-with-object-pattern.js @@ -0,0 +1 @@ +`${function() { let {x} = y; }}` \ No newline at end of file diff --git a/test/fixtures/ES6/template-literals/nested-function-with-object-pattern.tree.json b/test/fixtures/ES6/template-literals/nested-function-with-object-pattern.tree.json new file mode 100644 index 0000000..8ac8e68 --- /dev/null +++ b/test/fixtures/ES6/template-literals/nested-function-with-object-pattern.tree.json @@ -0,0 +1,528 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": false, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true, + "range": [ + 30, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "expressions": [ + { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "computed": false, + "value": { + "type": "Identifier", + "name": "x", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "init": { + "type": "Identifier", + "name": "y", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "kind": "let", + "range": [ + 16, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 14, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "generator": false, + "expression": false, + "async": false, + "range": [ + 3, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "tokens": [ + { + "type": "Template", + "value": "`${", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 3, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Template", + "value": "}`", + "range": [ + 30, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/ES6/template-literals/octal-literal.failure.json b/test/fixtures/ES6/template-literals/octal-literal.failure.json index 658b44d..186ee5e 100644 --- a/test/fixtures/ES6/template-literals/octal-literal.failure.json +++ b/test/fixtures/ES6/template-literals/octal-literal.failure.json @@ -1 +1 @@ -{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file +{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file diff --git a/test/fixtures/ES6/template-literals/strict-octal-literal.failure.json b/test/fixtures/ES6/template-literals/strict-octal-literal.failure.json index 0809dc2..4d00232 100644 --- a/test/fixtures/ES6/template-literals/strict-octal-literal.failure.json +++ b/test/fixtures/ES6/template-literals/strict-octal-literal.failure.json @@ -1 +1 @@ -{"index":17,"lineNumber":1,"column":18,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file +{"index":14,"lineNumber":1,"column":15,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file 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/fragment-with-child.js b/test/fixtures/JSX/fragment-with-child.js new file mode 100644 index 0000000..ac72d17 --- /dev/null +++ b/test/fixtures/JSX/fragment-with-child.js @@ -0,0 +1 @@ +<>
diff --git a/test/fixtures/JSX/fragment-with-child.tree.json b/test/fixtures/JSX/fragment-with-child.tree.json new file mode 100644 index 0000000..ca7b536 --- /dev/null +++ b/test/fixtures/JSX/fragment-with-child.tree.json @@ -0,0 +1,311 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningFragment", + "selfClosing": false, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "children": [ + { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "div", + "range": [ + 3, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "selfClosing": true, + "attributes": [], + "range": [ + 2, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 2, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "closingElement": { + "type": "JSXClosingFragment", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "JSXIdentifier", + "value": "div", + "range": [ + 3, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "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": "Punctuator", + "value": "<", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/JSX/fragment-with-children.js b/test/fixtures/JSX/fragment-with-children.js new file mode 100644 index 0000000..2f214ee --- /dev/null +++ b/test/fixtures/JSX/fragment-with-children.js @@ -0,0 +1 @@ +<>

{123}

diff --git a/test/fixtures/JSX/fragment-with-children.tree.json b/test/fixtures/JSX/fragment-with-children.tree.json new file mode 100644 index 0000000..9bc5550 --- /dev/null +++ b/test/fixtures/JSX/fragment-with-children.tree.json @@ -0,0 +1,618 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningFragment", + "selfClosing": false, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "children": [ + { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "div", + "range": [ + 3, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "selfClosing": true, + "attributes": [], + "range": [ + 2, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "children": [], + "closingElement": null, + "range": [ + 2, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "p", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "children": [ + { + "type": "JSXExpressionContainer", + "expression": { + "type": "Literal", + "value": 123, + "raw": "123", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "p", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 9, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "closingElement": { + "type": "JSXClosingFragment", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "JSXIdentifier", + "value": "div", + "range": [ + 3, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "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": "Punctuator", + "value": "<", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "JSXIdentifier", + "value": "p", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Numeric", + "value": "123", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "JSXIdentifier", + "value": "p", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/JSX/fragment.js b/test/fixtures/JSX/fragment.js new file mode 100644 index 0000000..4a80b22 --- /dev/null +++ b/test/fixtures/JSX/fragment.js @@ -0,0 +1 @@ +<> diff --git a/test/fixtures/JSX/fragment.tree.json b/test/fixtures/JSX/fragment.tree.json new file mode 100644 index 0000000..eb54d74 --- /dev/null +++ b/test/fixtures/JSX/fragment.tree.json @@ -0,0 +1,182 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningFragment", + "selfClosing": false, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "children": [], + "closingElement": { + "type": "JSXClosingFragment", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "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 + } + } + } + ] +} \ 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/JSX/invalid-fragment.failure.json b/test/fixtures/JSX/invalid-fragment.failure.json new file mode 100644 index 0000000..a817b6b --- /dev/null +++ b/test/fixtures/JSX/invalid-fragment.failure.json @@ -0,0 +1 @@ +{"index":8,"lineNumber":1,"column":9,"message":"Error: Line 1: Expected corresponding JSX closing tag for jsx fragment","description":"Expected corresponding JSX closing tag for jsx fragment"} \ No newline at end of file diff --git a/test/fixtures/JSX/invalid-fragment.js b/test/fixtures/JSX/invalid-fragment.js new file mode 100644 index 0000000..1635e53 --- /dev/null +++ b/test/fixtures/JSX/invalid-fragment.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/methods/class-async-method-computed.tree.json b/test/fixtures/es2017/async/methods/class-async-method-computed.tree.json index 8d2e31e..828868a 100644 --- a/test/fixtures/es2017/async/methods/class-async-method-computed.tree.json +++ b/test/fixtures/es2017/async/methods/class-async-method-computed.tree.json @@ -46,7 +46,7 @@ } } }, - "computed": false, + "computed": true, "value": { "type": "FunctionExpression", "id": null, 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/for-await-of.js b/test/fixtures/es2018/for-await-of/for-await-of.js new file mode 100644 index 0000000..1bcea30 --- /dev/null +++ b/test/fixtures/es2018/for-await-of/for-await-of.js @@ -0,0 +1 @@ +async function f() { for await (p of q); } diff --git a/test/fixtures/es2018/for-await-of/for-await-of.tree.json b/test/fixtures/es2018/for-await-of/for-await-of.tree.json new file mode 100644 index 0000000..68cfce9 --- /dev/null +++ b/test/fixtures/es2018/for-await-of/for-await-of.tree.json @@ -0,0 +1,421 @@ +{ + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ForOfStatement", + "await": true, + "left": { + "type": "Identifier", + "name": "p", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "right": { + "type": "Identifier", + "name": "q", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + "range": [ + 21, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "range": [ + 19, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "generator": false, + "expression": false, + "async": true, + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "async", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "for", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "p", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 34, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "q", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ] + } 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-8.failure.json b/test/fixtures/es2018/template-literal-revision/not-escape-8.failure.json new file mode 100644 index 0000000..3473d27 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/not-escape-8.failure.json @@ -0,0 +1 @@ +{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: \\8 and \\9 are not allowed in template strings.","description":"\\8 and \\9 are not allowed in template strings."} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-8.js b/test/fixtures/es2018/template-literal-revision/not-escape-8.js new file mode 100644 index 0000000..c6d92a5 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/not-escape-8.js @@ -0,0 +1 @@ +`\8` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-9.failure.json b/test/fixtures/es2018/template-literal-revision/not-escape-9.failure.json new file mode 100644 index 0000000..3473d27 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/not-escape-9.failure.json @@ -0,0 +1 @@ +{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: \\8 and \\9 are not allowed in template strings.","description":"\\8 and \\9 are not allowed in template strings."} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-9.js b/test/fixtures/es2018/template-literal-revision/not-escape-9.js new file mode 100644 index 0000000..8080ba7 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/not-escape-9.js @@ -0,0 +1 @@ +`\9` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-hex.failure.json b/test/fixtures/es2018/template-literal-revision/not-escape-hex.failure.json new file mode 100644 index 0000000..167b31a --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/not-escape-hex.failure.json @@ -0,0 +1 @@ +{"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/es2018/template-literal-revision/not-escape-hex.js b/test/fixtures/es2018/template-literal-revision/not-escape-hex.js new file mode 100644 index 0000000..3d9ac00 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/not-escape-hex.js @@ -0,0 +1 @@ +`\xTT` \ No newline at end of file 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/not-escape-unicode-code-point.failure.json b/test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.failure.json new file mode 100644 index 0000000..5a87f98 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.failure.json @@ -0,0 +1 @@ +{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: Invalid Unicode escape sequence","description":"Invalid Unicode escape sequence"} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.js b/test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.js new file mode 100644 index 0000000..62f4fe0 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.js @@ -0,0 +1 @@ +`\u{nicode}` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-unicode.failure.json b/test/fixtures/es2018/template-literal-revision/not-escape-unicode.failure.json new file mode 100644 index 0000000..5a87f98 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/not-escape-unicode.failure.json @@ -0,0 +1 @@ +{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: Invalid Unicode escape sequence","description":"Invalid Unicode escape sequence"} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-unicode.js b/test/fixtures/es2018/template-literal-revision/not-escape-unicode.js new file mode 100644 index 0000000..1c4b224 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/not-escape-unicode.js @@ -0,0 +1 @@ +`\unicode` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.failure.json b/test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.failure.json new file mode 100644 index 0000000..0d91669 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.failure.json @@ -0,0 +1 @@ +{"index":4,"lineNumber":1,"column":5,"message":"Error: Line 1: Invalid Unicode escape sequence","description":"Invalid Unicode escape sequence"} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.js b/test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.js new file mode 100644 index 0000000..3be78e5 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.js @@ -0,0 +1 @@ +`${a}\unicode` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.js b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.js new file mode 100644 index 0000000..a0beeae --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.js @@ -0,0 +1 @@ +a`\8` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.tree.json b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.tree.json new file mode 100644 index 0000000..8a9d86b --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.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": "\\8", + "cooked": null + }, + "tail": true, + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "expressions": [], + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Template", + "value": "`\\8`", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.js b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.js new file mode 100644 index 0000000..6a0e8d4 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.js @@ -0,0 +1 @@ +a`\9` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.tree.json b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.tree.json new file mode 100644 index 0000000..3f02a3f --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.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": "\\9", + "cooked": null + }, + "tail": true, + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "expressions": [], + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Template", + "value": "`\\9`", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.js b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.js new file mode 100644 index 0000000..1ebc7c9 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.js @@ -0,0 +1 @@ +a`\xTT` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.tree.json b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.tree.json new file mode 100644 index 0000000..f344e79 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.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": "\\xTT", + "cooked": null + }, + "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": "`\\xTT`", + "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/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/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.js b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.js new file mode 100644 index 0000000..c204a1d --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.js @@ -0,0 +1 @@ +a`\u{nicode}` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.tree.json b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.tree.json new file mode 100644 index 0000000..5653ef7 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.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": "\\u{nicode}", + "cooked": null + }, + "tail": true, + "range": [ + 1, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "expressions": [], + "range": [ + 1, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Template", + "value": "`\\u{nicode}`", + "range": [ + 1, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.js b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.js new file mode 100644 index 0000000..df6df61 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.js @@ -0,0 +1 @@ +a`\unicode` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.tree.json b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.tree.json new file mode 100644 index 0000000..9572166 --- /dev/null +++ b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.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": "\\unicode", + "cooked": null + }, + "tail": true, + "range": [ + 1, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "expressions": [], + "range": [ + 1, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Template", + "value": "`\\unicode`", + "range": [ + 1, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/es2019/optional-catch-binding/optional-catch-binding.js b/test/fixtures/es2019/optional-catch-binding/optional-catch-binding.js new file mode 100644 index 0000000..0c6986f --- /dev/null +++ b/test/fixtures/es2019/optional-catch-binding/optional-catch-binding.js @@ -0,0 +1 @@ +try {} catch {} diff --git a/test/fixtures/es2019/optional-catch-binding/optional-catch-binding.tree.json b/test/fixtures/es2019/optional-catch-binding/optional-catch-binding.tree.json new file mode 100644 index 0000000..e6437f4 --- /dev/null +++ b/test/fixtures/es2019/optional-catch-binding/optional-catch-binding.tree.json @@ -0,0 +1,202 @@ +{ + "type": "Program", + "body": [ + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "handler": { + "type": "CatchClause", + "param": null, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "finalizer": null, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "try", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "catch", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.failure.json b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.failure.json new file mode 100644 index 0000000..3eb16de --- /dev/null +++ b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.failure.json @@ -0,0 +1 @@ +{"index":7,"lineNumber":1,"column":8,"message":"Error: Line 1: Unexpected token ??","description":"Unexpected token ??"} \ No newline at end of file diff --git a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.js b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.js new file mode 100644 index 0000000..bf526ba --- /dev/null +++ b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.js @@ -0,0 +1 @@ +1 && 2 ?? 3 \ No newline at end of file diff --git a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.failure.json b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.failure.json new file mode 100644 index 0000000..254908f --- /dev/null +++ b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.failure.json @@ -0,0 +1 @@ +{"index":7,"lineNumber":1,"column":8,"message":"Error: Line 1: Unexpected token &&","description":"Unexpected token &&"} \ No newline at end of file diff --git a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.js b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.js new file mode 100644 index 0000000..a1f133c --- /dev/null +++ b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.js @@ -0,0 +1 @@ +1 ?? 2 && 3 \ No newline at end of file diff --git a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.failure.json b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.failure.json new file mode 100644 index 0000000..b5df149 --- /dev/null +++ b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.failure.json @@ -0,0 +1 @@ +{"index":7,"lineNumber":1,"column":8,"message":"Error: Line 1: Unexpected token ||","description":"Unexpected token ||"} \ No newline at end of file diff --git a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.js b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.js new file mode 100644 index 0000000..86d9379 --- /dev/null +++ b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.js @@ -0,0 +1 @@ +1 ?? 2 || 3 \ 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/binary/multiline_string_literal.js b/test/fixtures/expression/binary/multiline_string_literal.js new file mode 100644 index 0000000..61869a0 --- /dev/null +++ b/test/fixtures/expression/binary/multiline_string_literal.js @@ -0,0 +1,3 @@ +var str = 'test \ +d'+'test \ +test'+'f'; diff --git a/test/fixtures/expression/binary/multiline_string_literal.tree.json b/test/fixtures/expression/binary/multiline_string_literal.tree.json new file mode 100644 index 0000000..433ace0 --- /dev/null +++ b/test/fixtures/expression/binary/multiline_string_literal.tree.json @@ -0,0 +1,332 @@ + { + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "name": "str" + }, + "init": { + "range": [ + 10, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "type": "BinaryExpression", + "operator": "+", + "left": { + "range": [ + 10, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "type": "BinaryExpression", + "operator": "+", + "left": { + "range": [ + 10, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "type": "Literal", + "value": "test d", + "raw": "'test \\\r\nd'" + }, + "right": { + "range": [ + 22, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "type": "Literal", + "value": "test test", + "raw": "'test \\\r\ntest'" + } + }, + "right": { + "range": [ + 37, + 40 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "type": "Literal", + "value": "f", + "raw": "'f'" + } + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Keyword", + "value": "var" + }, + { + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Identifier", + "value": "str" + }, + { + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "type": "Punctuator", + "value": "=" + }, + { + "range": [ + 10, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "type": "String", + "value": "'test \\\r\nd'" + }, + { + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "type": "Punctuator", + "value": "+" + }, + { + "range": [ + 22, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "type": "String", + "value": "'test \\\r\ntest'" + }, + { + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "type": "Punctuator", + "value": "+" + }, + { + "range": [ + 37, + 40 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "type": "String", + "value": "'f'" + }, + { + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "type": "Punctuator", + "value": ";" + } + ] +} \ 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/expression/primary/literal/regular-expression/u-flag-valid-range.tree.json b/test/fixtures/expression/primary/literal/regular-expression/u-flag-valid-range.tree.json index 90de9f6..5dd777e 100644 --- a/test/fixtures/expression/primary/literal/regular-expression/u-flag-valid-range.tree.json +++ b/test/fixtures/expression/primary/literal/regular-expression/u-flag-valid-range.tree.json @@ -26,7 +26,7 @@ }, "init": { "type": "Literal", - "value": {}, + "value": null, "raw": "/[\\u{61}-b][\\u0061-b][a-\\u{62}][a-\\u0062]\\u{1ffff}/u", "regex": { "pattern": "[\\u{61}-b][\\u0061-b][a-\\u{62}][a-\\u0062]\\u{1ffff}", 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/else-declaration-following-classic-for.js b/test/fixtures/statement/if/else-declaration-following-classic-for.js new file mode 100644 index 0000000..4cc3f8c --- /dev/null +++ b/test/fixtures/statement/if/else-declaration-following-classic-for.js @@ -0,0 +1,6 @@ +if (true) + for (1;;) + 1; +else + for (x of y) + 2; diff --git a/test/fixtures/statement/if/else-declaration-following-classic-for.tree.json b/test/fixtures/statement/if/else-declaration-following-classic-for.tree.json new file mode 100644 index 0000000..df445b6 --- /dev/null +++ b/test/fixtures/statement/if/else-declaration-following-classic-for.tree.json @@ -0,0 +1,600 @@ +{ + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "consequent": { + "type": "ForStatement", + "init": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "test": null, + "update": null, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "range": [ + 32, + 34 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "range": [ + 14, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "alternate": { + "type": "ForOfStatement", + "await": false, + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 65, + 67 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "range": [ + 44, + 67 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "range": [ + 0, + 67 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 10 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 67 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 10 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "for", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "else", + "range": [ + 35, + 39 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "for", + "range": [ + 44, + 47 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 51, + 53 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + } + } + } + ] +} \ No newline at end of file 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/for-of-missing-parenthesis.tree.json b/test/fixtures/tolerant-parse/for-of-missing-parenthesis.tree.json index 4e2312c..668b946 100644 --- a/test/fixtures/tolerant-parse/for-of-missing-parenthesis.tree.json +++ b/test/fixtures/tolerant-parse/for-of-missing-parenthesis.tree.json @@ -3,6 +3,7 @@ "body": [ { "type": "ForOfStatement", + "await": false, "left": { "type": "Identifier", "name": "x", 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 From 2e108bf41d66a4c4517405d5d398225b250207f8 Mon Sep 17 00:00:00 2001 From: Jeremy Mill Date: Mon, 24 May 2021 12:20:12 -0400 Subject: [PATCH 6/8] fix typos --- esprima/parser.py | 4 ++-- esprima/scanner.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/esprima/parser.py b/esprima/parser.py index 0efd2e6..e37f64e 100644 --- a/esprima/parser.py +++ b/esprima/parser.py @@ -1098,7 +1098,7 @@ def parseLeftHandSideExpressionAllowCall(self): hasOptional = False while True: optional = False - if self.match('?/.'): + if self.match('?.'): optional = True hasOptional = True self.expect('?.') @@ -1148,7 +1148,7 @@ def parseLeftHandSideExpressionAllowCall(self): break self.context.allowIn = previousAllowIn - if optional: + if hasOptional: return Node.ChainExpression(expr) return expr diff --git a/esprima/scanner.py b/esprima/scanner.py index 6260361..31103ae 100644 --- a/esprima/scanner.py +++ b/esprima/scanner.py @@ -568,7 +568,7 @@ def scanPunctuator(self): if self.source[self.index] == '?': self.index += 1 str = '??' - if self.source[self.index] == '.' and self.source[self.index + 1].isdigit(): + 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 From 0404c011af46d04314f3c39cd6800d0bc1cd7efb Mon Sep 17 00:00:00 2001 From: Jeremy Mill Date: Mon, 24 May 2021 16:57:25 -0400 Subject: [PATCH 7/8] remove unsupported tests --- .../for-of/for-of-array-pattern-let.tree.json | 1 - .../for-of/for-of-array-pattern-var.tree.json | 1 - .../ES6/for-of/for-of-array-pattern.tree.json | 1 - test/fixtures/ES6/for-of/for-of-let.tree.json | 1 - .../for-of-object-pattern-const.tree.json | 1 - .../for-of-object-pattern-var.tree.json | 1 - .../for-of/for-of-object-pattern.tree.json | 1 - .../ES6/for-of/for-of-with-const.tree.json | 1 - .../ES6/for-of/for-of-with-let.tree.json | 1 - .../ES6/for-of/for-of-with-var.tree.json | 1 - test/fixtures/ES6/for-of/for-of.tree.json | 1 - test/fixtures/ES6/for-of/let-of-of.tree.json | 1 - .../invalid-escape.failure.json | 2 +- .../nested-function-with-object-pattern.js | 1 - ...ted-function-with-object-pattern.tree.json | 528 --------------- .../octal-literal.failure.json | 2 +- .../strict-octal-literal.failure.json | 2 +- test/fixtures/JSX/fragment-with-child.js | 1 - .../JSX/fragment-with-child.tree.json | 311 --------- test/fixtures/JSX/fragment-with-children.js | 1 - .../JSX/fragment-with-children.tree.json | 618 ------------------ test/fixtures/JSX/fragment.js | 1 - test/fixtures/JSX/fragment.tree.json | 182 ------ .../JSX/invalid-fragment.failure.json | 1 - test/fixtures/JSX/invalid-fragment.js | 1 - .../es2018/for-await-of/for-await-of.js | 1 - .../for-await-of/for-await-of.tree.json | 421 ------------ .../not-escape-8.failure.json | 1 - .../template-literal-revision/not-escape-8.js | 1 - .../not-escape-9.failure.json | 1 - .../template-literal-revision/not-escape-9.js | 1 - .../not-escape-hex.failure.json | 1 - .../not-escape-hex.js | 1 - ...not-escape-unicode-code-point.failure.json | 1 - .../not-escape-unicode-code-point.js | 1 - .../not-escape-unicode.failure.json | 1 - .../not-escape-unicode.js | 1 - .../span-not-escape-unicode.failure.json | 1 - .../span-not-escape-unicode.js | 1 - .../tagged-not-escape-8.js | 1 - .../tagged-not-escape-8.tree.json | 152 ----- .../tagged-not-escape-9.js | 1 - .../tagged-not-escape-9.tree.json | 152 ----- .../tagged-not-escape-hex.js | 1 - .../tagged-not-escape-hex.tree.json | 152 ----- .../tagged-not-escape-unicode-code-point.js | 1 - ...ed-not-escape-unicode-code-point.tree.json | 152 ----- .../tagged-not-escape-unicode.js | 1 - .../tagged-not-escape-unicode.tree.json | 152 ----- .../optional-catch-binding.js | 1 - .../optional-catch-binding.tree.json | 202 ------ ...ish-coalescing-chain-and-head.failure.json | 1 - ...valid-nullish-coalescing-chain-and-head.js | 1 - ...ish-coalescing-chain-and-tail.failure.json | 1 - ...valid-nullish-coalescing-chain-and-tail.js | 1 - ...lish-coalescing-chain-or-tail.failure.json | 1 - ...nvalid-nullish-coalescing-chain-or-tail.js | 1 - .../binary/multiline_string_literal.js | 3 - .../binary/multiline_string_literal.tree.json | 332 ---------- .../else-declaration-following-classic-for.js | 6 - ...eclaration-following-classic-for.tree.json | 600 ----------------- 61 files changed, 3 insertions(+), 4009 deletions(-) delete mode 100644 test/fixtures/ES6/template-literals/nested-function-with-object-pattern.js delete mode 100644 test/fixtures/ES6/template-literals/nested-function-with-object-pattern.tree.json delete mode 100644 test/fixtures/JSX/fragment-with-child.js delete mode 100644 test/fixtures/JSX/fragment-with-child.tree.json delete mode 100644 test/fixtures/JSX/fragment-with-children.js delete mode 100644 test/fixtures/JSX/fragment-with-children.tree.json delete mode 100644 test/fixtures/JSX/fragment.js delete mode 100644 test/fixtures/JSX/fragment.tree.json delete mode 100644 test/fixtures/JSX/invalid-fragment.failure.json delete mode 100644 test/fixtures/JSX/invalid-fragment.js delete mode 100644 test/fixtures/es2018/for-await-of/for-await-of.js delete mode 100644 test/fixtures/es2018/for-await-of/for-await-of.tree.json delete mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-8.failure.json delete mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-8.js delete mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-9.failure.json delete mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-9.js delete mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-hex.failure.json delete mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-hex.js delete mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.failure.json delete mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.js delete mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-unicode.failure.json delete mode 100644 test/fixtures/es2018/template-literal-revision/not-escape-unicode.js delete mode 100644 test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.failure.json delete mode 100644 test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.js delete mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.js delete mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.tree.json delete mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.js delete mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.tree.json delete mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.js delete mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.tree.json delete mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.js delete mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.tree.json delete mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.js delete mode 100644 test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.tree.json delete mode 100644 test/fixtures/es2019/optional-catch-binding/optional-catch-binding.js delete mode 100644 test/fixtures/es2019/optional-catch-binding/optional-catch-binding.tree.json delete mode 100644 test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.failure.json delete mode 100644 test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.js delete mode 100644 test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.failure.json delete mode 100644 test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.js delete mode 100644 test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.failure.json delete mode 100644 test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.js delete mode 100644 test/fixtures/expression/binary/multiline_string_literal.js delete mode 100644 test/fixtures/expression/binary/multiline_string_literal.tree.json delete mode 100644 test/fixtures/statement/if/else-declaration-following-classic-for.js delete mode 100644 test/fixtures/statement/if/else-declaration-following-classic-for.tree.json diff --git a/test/fixtures/ES6/for-of/for-of-array-pattern-let.tree.json b/test/fixtures/ES6/for-of/for-of-array-pattern-let.tree.json index 74b307e..419164e 100644 --- a/test/fixtures/ES6/for-of/for-of-array-pattern-let.tree.json +++ b/test/fixtures/ES6/for-of/for-of-array-pattern-let.tree.json @@ -17,7 +17,6 @@ } }, "type": "ForOfStatement", - "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-array-pattern-var.tree.json b/test/fixtures/ES6/for-of/for-of-array-pattern-var.tree.json index d3838b7..dbb3799 100644 --- a/test/fixtures/ES6/for-of/for-of-array-pattern-var.tree.json +++ b/test/fixtures/ES6/for-of/for-of-array-pattern-var.tree.json @@ -17,7 +17,6 @@ } }, "type": "ForOfStatement", - "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-array-pattern.tree.json b/test/fixtures/ES6/for-of/for-of-array-pattern.tree.json index e2311f0..9a7b8fa 100644 --- a/test/fixtures/ES6/for-of/for-of-array-pattern.tree.json +++ b/test/fixtures/ES6/for-of/for-of-array-pattern.tree.json @@ -17,7 +17,6 @@ } }, "type": "ForOfStatement", - "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-let.tree.json b/test/fixtures/ES6/for-of/for-of-let.tree.json index 5202be9..797bd0e 100644 --- a/test/fixtures/ES6/for-of/for-of-let.tree.json +++ b/test/fixtures/ES6/for-of/for-of-let.tree.json @@ -31,7 +31,6 @@ } }, "type": "ForOfStatement", - "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-object-pattern-const.tree.json b/test/fixtures/ES6/for-of/for-of-object-pattern-const.tree.json index a1bcb25..8cc1ea2 100644 --- a/test/fixtures/ES6/for-of/for-of-object-pattern-const.tree.json +++ b/test/fixtures/ES6/for-of/for-of-object-pattern-const.tree.json @@ -17,7 +17,6 @@ } }, "type": "ForOfStatement", - "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-object-pattern-var.tree.json b/test/fixtures/ES6/for-of/for-of-object-pattern-var.tree.json index 0bfd049..5e4d9a4 100644 --- a/test/fixtures/ES6/for-of/for-of-object-pattern-var.tree.json +++ b/test/fixtures/ES6/for-of/for-of-object-pattern-var.tree.json @@ -17,7 +17,6 @@ } }, "type": "ForOfStatement", - "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-object-pattern.tree.json b/test/fixtures/ES6/for-of/for-of-object-pattern.tree.json index a3e9917..5b4fd7a 100644 --- a/test/fixtures/ES6/for-of/for-of-object-pattern.tree.json +++ b/test/fixtures/ES6/for-of/for-of-object-pattern.tree.json @@ -17,7 +17,6 @@ } }, "type": "ForOfStatement", - "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-with-const.tree.json b/test/fixtures/ES6/for-of/for-of-with-const.tree.json index 83248e4..a0d5ed7 100644 --- a/test/fixtures/ES6/for-of/for-of-with-const.tree.json +++ b/test/fixtures/ES6/for-of/for-of-with-const.tree.json @@ -17,7 +17,6 @@ } }, "type": "ForOfStatement", - "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-with-let.tree.json b/test/fixtures/ES6/for-of/for-of-with-let.tree.json index c845a0d..6dc117b 100644 --- a/test/fixtures/ES6/for-of/for-of-with-let.tree.json +++ b/test/fixtures/ES6/for-of/for-of-with-let.tree.json @@ -17,7 +17,6 @@ } }, "type": "ForOfStatement", - "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of-with-var.tree.json b/test/fixtures/ES6/for-of/for-of-with-var.tree.json index a926d36..a4b4100 100644 --- a/test/fixtures/ES6/for-of/for-of-with-var.tree.json +++ b/test/fixtures/ES6/for-of/for-of-with-var.tree.json @@ -17,7 +17,6 @@ } }, "type": "ForOfStatement", - "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/for-of.tree.json b/test/fixtures/ES6/for-of/for-of.tree.json index 46c086c..83dbb37 100644 --- a/test/fixtures/ES6/for-of/for-of.tree.json +++ b/test/fixtures/ES6/for-of/for-of.tree.json @@ -17,7 +17,6 @@ } }, "type": "ForOfStatement", - "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/for-of/let-of-of.tree.json b/test/fixtures/ES6/for-of/let-of-of.tree.json index 6c3e2cb..7e0abdb 100644 --- a/test/fixtures/ES6/for-of/let-of-of.tree.json +++ b/test/fixtures/ES6/for-of/let-of-of.tree.json @@ -17,7 +17,6 @@ } }, "type": "ForOfStatement", - "await": false, "left": { "range": [ 5, diff --git a/test/fixtures/ES6/template-literals/invalid-escape.failure.json b/test/fixtures/ES6/template-literals/invalid-escape.failure.json index 186ee5e..658b44d 100644 --- a/test/fixtures/ES6/template-literals/invalid-escape.failure.json +++ b/test/fixtures/ES6/template-literals/invalid-escape.failure.json @@ -1 +1 @@ -{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file diff --git a/test/fixtures/ES6/template-literals/nested-function-with-object-pattern.js b/test/fixtures/ES6/template-literals/nested-function-with-object-pattern.js deleted file mode 100644 index 8314cd4..0000000 --- a/test/fixtures/ES6/template-literals/nested-function-with-object-pattern.js +++ /dev/null @@ -1 +0,0 @@ -`${function() { let {x} = y; }}` \ No newline at end of file diff --git a/test/fixtures/ES6/template-literals/nested-function-with-object-pattern.tree.json b/test/fixtures/ES6/template-literals/nested-function-with-object-pattern.tree.json deleted file mode 100644 index 8ac8e68..0000000 --- a/test/fixtures/ES6/template-literals/nested-function-with-object-pattern.tree.json +++ /dev/null @@ -1,528 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "TemplateLiteral", - "quasis": [ - { - "type": "TemplateElement", - "value": { - "raw": "", - "cooked": "" - }, - "tail": false, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "TemplateElement", - "value": { - "raw": "", - "cooked": "" - }, - "tail": true, - "range": [ - 30, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - ], - "expressions": [ - { - "type": "FunctionExpression", - "id": null, - "params": [], - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "computed": false, - "value": { - "type": "Identifier", - "name": "x", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ], - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "init": { - "type": "Identifier", - "name": "y", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 20, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - } - } - ], - "kind": "let", - "range": [ - 16, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ], - "range": [ - 14, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 3, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 30 - } - } - } - ], - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "tokens": [ - { - "type": "Template", - "value": "`${", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 3, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 16, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Template", - "value": "}`", - "range": [ - 30, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - ] -} \ No newline at end of file diff --git a/test/fixtures/ES6/template-literals/octal-literal.failure.json b/test/fixtures/ES6/template-literals/octal-literal.failure.json index 186ee5e..74d4d2e 100644 --- a/test/fixtures/ES6/template-literals/octal-literal.failure.json +++ b/test/fixtures/ES6/template-literals/octal-literal.failure.json @@ -1 +1 @@ -{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file +{"index":0,"lineNumber":1,"column":4,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file diff --git a/test/fixtures/ES6/template-literals/strict-octal-literal.failure.json b/test/fixtures/ES6/template-literals/strict-octal-literal.failure.json index 4d00232..0809dc2 100644 --- a/test/fixtures/ES6/template-literals/strict-octal-literal.failure.json +++ b/test/fixtures/ES6/template-literals/strict-octal-literal.failure.json @@ -1 +1 @@ -{"index":14,"lineNumber":1,"column":15,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file +{"index":17,"lineNumber":1,"column":18,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file diff --git a/test/fixtures/JSX/fragment-with-child.js b/test/fixtures/JSX/fragment-with-child.js deleted file mode 100644 index ac72d17..0000000 --- a/test/fixtures/JSX/fragment-with-child.js +++ /dev/null @@ -1 +0,0 @@ -<>
diff --git a/test/fixtures/JSX/fragment-with-child.tree.json b/test/fixtures/JSX/fragment-with-child.tree.json deleted file mode 100644 index ca7b536..0000000 --- a/test/fixtures/JSX/fragment-with-child.tree.json +++ /dev/null @@ -1,311 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "JSXElement", - "openingElement": { - "type": "JSXOpeningFragment", - "selfClosing": false, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "children": [ - { - "type": "JSXElement", - "openingElement": { - "type": "JSXOpeningElement", - "name": { - "type": "JSXIdentifier", - "name": "div", - "range": [ - 3, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "selfClosing": true, - "attributes": [], - "range": [ - 2, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "children": [], - "closingElement": null, - "range": [ - 2, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - } - } - ], - "closingElement": { - "type": "JSXClosingFragment", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "JSXIdentifier", - "value": "div", - "range": [ - 3, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "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": "Punctuator", - "value": "<", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ] -} \ No newline at end of file diff --git a/test/fixtures/JSX/fragment-with-children.js b/test/fixtures/JSX/fragment-with-children.js deleted file mode 100644 index 2f214ee..0000000 --- a/test/fixtures/JSX/fragment-with-children.js +++ /dev/null @@ -1 +0,0 @@ -<>

{123}

diff --git a/test/fixtures/JSX/fragment-with-children.tree.json b/test/fixtures/JSX/fragment-with-children.tree.json deleted file mode 100644 index 9bc5550..0000000 --- a/test/fixtures/JSX/fragment-with-children.tree.json +++ /dev/null @@ -1,618 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "JSXElement", - "openingElement": { - "type": "JSXOpeningFragment", - "selfClosing": false, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "children": [ - { - "type": "JSXElement", - "openingElement": { - "type": "JSXOpeningElement", - "name": { - "type": "JSXIdentifier", - "name": "div", - "range": [ - 3, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "selfClosing": true, - "attributes": [], - "range": [ - 2, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "children": [], - "closingElement": null, - "range": [ - 2, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "JSXElement", - "openingElement": { - "type": "JSXOpeningElement", - "name": { - "type": "JSXIdentifier", - "name": "p", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "selfClosing": false, - "attributes": [], - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "children": [ - { - "type": "JSXExpressionContainer", - "expression": { - "type": "Literal", - "value": 123, - "raw": "123", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 12, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - "closingElement": { - "type": "JSXClosingElement", - "name": { - "type": "JSXIdentifier", - "name": "p", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 17, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 9, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "closingElement": { - "type": "JSXClosingFragment", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "JSXIdentifier", - "value": "div", - "range": [ - 3, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "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": "Punctuator", - "value": "<", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "JSXIdentifier", - "value": "p", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Numeric", - "value": "123", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "JSXIdentifier", - "value": "p", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ] -} \ No newline at end of file diff --git a/test/fixtures/JSX/fragment.js b/test/fixtures/JSX/fragment.js deleted file mode 100644 index 4a80b22..0000000 --- a/test/fixtures/JSX/fragment.js +++ /dev/null @@ -1 +0,0 @@ -<> diff --git a/test/fixtures/JSX/fragment.tree.json b/test/fixtures/JSX/fragment.tree.json deleted file mode 100644 index eb54d74..0000000 --- a/test/fixtures/JSX/fragment.tree.json +++ /dev/null @@ -1,182 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "JSXElement", - "openingElement": { - "type": "JSXOpeningFragment", - "selfClosing": false, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "children": [], - "closingElement": { - "type": "JSXClosingFragment", - "range": [ - 2, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "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 - } - } - } - ] -} \ No newline at end of file diff --git a/test/fixtures/JSX/invalid-fragment.failure.json b/test/fixtures/JSX/invalid-fragment.failure.json deleted file mode 100644 index a817b6b..0000000 --- a/test/fixtures/JSX/invalid-fragment.failure.json +++ /dev/null @@ -1 +0,0 @@ -{"index":8,"lineNumber":1,"column":9,"message":"Error: Line 1: Expected corresponding JSX closing tag for jsx fragment","description":"Expected corresponding JSX closing tag for jsx fragment"} \ No newline at end of file diff --git a/test/fixtures/JSX/invalid-fragment.js b/test/fixtures/JSX/invalid-fragment.js deleted file mode 100644 index 1635e53..0000000 --- a/test/fixtures/JSX/invalid-fragment.js +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/fixtures/es2018/for-await-of/for-await-of.js b/test/fixtures/es2018/for-await-of/for-await-of.js deleted file mode 100644 index 1bcea30..0000000 --- a/test/fixtures/es2018/for-await-of/for-await-of.js +++ /dev/null @@ -1 +0,0 @@ -async function f() { for await (p of q); } diff --git a/test/fixtures/es2018/for-await-of/for-await-of.tree.json b/test/fixtures/es2018/for-await-of/for-await-of.tree.json deleted file mode 100644 index 68cfce9..0000000 --- a/test/fixtures/es2018/for-await-of/for-await-of.tree.json +++ /dev/null @@ -1,421 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "f", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "params": [], - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ForOfStatement", - "await": true, - "left": { - "type": "Identifier", - "name": "p", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "right": { - "type": "Identifier", - "name": "q", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "body": { - "type": "EmptyStatement", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - "range": [ - 21, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ], - "range": [ - 19, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - "generator": false, - "expression": false, - "async": true, - "range": [ - 0, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "tokens": [ - { - "type": "Identifier", - "value": "async", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 6, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "f", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "for", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "await", - "range": [ - 25, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "p", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Identifier", - "value": "of", - "range": [ - 34, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Identifier", - "value": "q", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - } - } - ] - } diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-8.failure.json b/test/fixtures/es2018/template-literal-revision/not-escape-8.failure.json deleted file mode 100644 index 3473d27..0000000 --- a/test/fixtures/es2018/template-literal-revision/not-escape-8.failure.json +++ /dev/null @@ -1 +0,0 @@ -{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: \\8 and \\9 are not allowed in template strings.","description":"\\8 and \\9 are not allowed in template strings."} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-8.js b/test/fixtures/es2018/template-literal-revision/not-escape-8.js deleted file mode 100644 index c6d92a5..0000000 --- a/test/fixtures/es2018/template-literal-revision/not-escape-8.js +++ /dev/null @@ -1 +0,0 @@ -`\8` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-9.failure.json b/test/fixtures/es2018/template-literal-revision/not-escape-9.failure.json deleted file mode 100644 index 3473d27..0000000 --- a/test/fixtures/es2018/template-literal-revision/not-escape-9.failure.json +++ /dev/null @@ -1 +0,0 @@ -{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: \\8 and \\9 are not allowed in template strings.","description":"\\8 and \\9 are not allowed in template strings."} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-9.js b/test/fixtures/es2018/template-literal-revision/not-escape-9.js deleted file mode 100644 index 8080ba7..0000000 --- a/test/fixtures/es2018/template-literal-revision/not-escape-9.js +++ /dev/null @@ -1 +0,0 @@ -`\9` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-hex.failure.json b/test/fixtures/es2018/template-literal-revision/not-escape-hex.failure.json deleted file mode 100644 index 167b31a..0000000 --- a/test/fixtures/es2018/template-literal-revision/not-escape-hex.failure.json +++ /dev/null @@ -1 +0,0 @@ -{"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/es2018/template-literal-revision/not-escape-hex.js b/test/fixtures/es2018/template-literal-revision/not-escape-hex.js deleted file mode 100644 index 3d9ac00..0000000 --- a/test/fixtures/es2018/template-literal-revision/not-escape-hex.js +++ /dev/null @@ -1 +0,0 @@ -`\xTT` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.failure.json b/test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.failure.json deleted file mode 100644 index 5a87f98..0000000 --- a/test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.failure.json +++ /dev/null @@ -1 +0,0 @@ -{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: Invalid Unicode escape sequence","description":"Invalid Unicode escape sequence"} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.js b/test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.js deleted file mode 100644 index 62f4fe0..0000000 --- a/test/fixtures/es2018/template-literal-revision/not-escape-unicode-code-point.js +++ /dev/null @@ -1 +0,0 @@ -`\u{nicode}` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-unicode.failure.json b/test/fixtures/es2018/template-literal-revision/not-escape-unicode.failure.json deleted file mode 100644 index 5a87f98..0000000 --- a/test/fixtures/es2018/template-literal-revision/not-escape-unicode.failure.json +++ /dev/null @@ -1 +0,0 @@ -{"index":0,"lineNumber":1,"column":1,"message":"Error: Line 1: Invalid Unicode escape sequence","description":"Invalid Unicode escape sequence"} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/not-escape-unicode.js b/test/fixtures/es2018/template-literal-revision/not-escape-unicode.js deleted file mode 100644 index 1c4b224..0000000 --- a/test/fixtures/es2018/template-literal-revision/not-escape-unicode.js +++ /dev/null @@ -1 +0,0 @@ -`\unicode` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.failure.json b/test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.failure.json deleted file mode 100644 index 0d91669..0000000 --- a/test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.failure.json +++ /dev/null @@ -1 +0,0 @@ -{"index":4,"lineNumber":1,"column":5,"message":"Error: Line 1: Invalid Unicode escape sequence","description":"Invalid Unicode escape sequence"} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.js b/test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.js deleted file mode 100644 index 3be78e5..0000000 --- a/test/fixtures/es2018/template-literal-revision/span-not-escape-unicode.js +++ /dev/null @@ -1 +0,0 @@ -`${a}\unicode` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.js b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.js deleted file mode 100644 index a0beeae..0000000 --- a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.js +++ /dev/null @@ -1 +0,0 @@ -a`\8` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.tree.json b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.tree.json deleted file mode 100644 index 8a9d86b..0000000 --- a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-8.tree.json +++ /dev/null @@ -1,152 +0,0 @@ -{ - "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": "\\8", - "cooked": null - }, - "tail": true, - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "expressions": [], - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "tokens": [ - { - "type": "Identifier", - "value": "a", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Template", - "value": "`\\8`", - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ] -} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.js b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.js deleted file mode 100644 index 6a0e8d4..0000000 --- a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.js +++ /dev/null @@ -1 +0,0 @@ -a`\9` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.tree.json b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.tree.json deleted file mode 100644 index 3f02a3f..0000000 --- a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-9.tree.json +++ /dev/null @@ -1,152 +0,0 @@ -{ - "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": "\\9", - "cooked": null - }, - "tail": true, - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "expressions": [], - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "tokens": [ - { - "type": "Identifier", - "value": "a", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Template", - "value": "`\\9`", - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ] -} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.js b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.js deleted file mode 100644 index 1ebc7c9..0000000 --- a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.js +++ /dev/null @@ -1 +0,0 @@ -a`\xTT` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.tree.json b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.tree.json deleted file mode 100644 index f344e79..0000000 --- a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-hex.tree.json +++ /dev/null @@ -1,152 +0,0 @@ -{ - "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": "\\xTT", - "cooked": null - }, - "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": "`\\xTT`", - "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/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.js b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.js deleted file mode 100644 index c204a1d..0000000 --- a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.js +++ /dev/null @@ -1 +0,0 @@ -a`\u{nicode}` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.tree.json b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.tree.json deleted file mode 100644 index 5653ef7..0000000 --- a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode-code-point.tree.json +++ /dev/null @@ -1,152 +0,0 @@ -{ - "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": "\\u{nicode}", - "cooked": null - }, - "tail": true, - "range": [ - 1, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "expressions": [], - "range": [ - 1, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "tokens": [ - { - "type": "Identifier", - "value": "a", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Template", - "value": "`\\u{nicode}`", - "range": [ - 1, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ] -} \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.js b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.js deleted file mode 100644 index df6df61..0000000 --- a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.js +++ /dev/null @@ -1 +0,0 @@ -a`\unicode` \ No newline at end of file diff --git a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.tree.json b/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.tree.json deleted file mode 100644 index 9572166..0000000 --- a/test/fixtures/es2018/template-literal-revision/tagged-not-escape-unicode.tree.json +++ /dev/null @@ -1,152 +0,0 @@ -{ - "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": "\\unicode", - "cooked": null - }, - "tail": true, - "range": [ - 1, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ], - "expressions": [], - "range": [ - 1, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "tokens": [ - { - "type": "Identifier", - "value": "a", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Template", - "value": "`\\unicode`", - "range": [ - 1, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ] -} \ No newline at end of file diff --git a/test/fixtures/es2019/optional-catch-binding/optional-catch-binding.js b/test/fixtures/es2019/optional-catch-binding/optional-catch-binding.js deleted file mode 100644 index 0c6986f..0000000 --- a/test/fixtures/es2019/optional-catch-binding/optional-catch-binding.js +++ /dev/null @@ -1 +0,0 @@ -try {} catch {} diff --git a/test/fixtures/es2019/optional-catch-binding/optional-catch-binding.tree.json b/test/fixtures/es2019/optional-catch-binding/optional-catch-binding.tree.json deleted file mode 100644 index e6437f4..0000000 --- a/test/fixtures/es2019/optional-catch-binding/optional-catch-binding.tree.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "body": [], - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "handler": { - "type": "CatchClause", - "param": null, - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 13, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 7, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "finalizer": null, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "try", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "catch", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] -} \ No newline at end of file diff --git a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.failure.json b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.failure.json deleted file mode 100644 index 3eb16de..0000000 --- a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.failure.json +++ /dev/null @@ -1 +0,0 @@ -{"index":7,"lineNumber":1,"column":8,"message":"Error: Line 1: Unexpected token ??","description":"Unexpected token ??"} \ No newline at end of file diff --git a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.js b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.js deleted file mode 100644 index bf526ba..0000000 --- a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-head.js +++ /dev/null @@ -1 +0,0 @@ -1 && 2 ?? 3 \ No newline at end of file diff --git a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.failure.json b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.failure.json deleted file mode 100644 index 254908f..0000000 --- a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.failure.json +++ /dev/null @@ -1 +0,0 @@ -{"index":7,"lineNumber":1,"column":8,"message":"Error: Line 1: Unexpected token &&","description":"Unexpected token &&"} \ No newline at end of file diff --git a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.js b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.js deleted file mode 100644 index a1f133c..0000000 --- a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-and-tail.js +++ /dev/null @@ -1 +0,0 @@ -1 ?? 2 && 3 \ No newline at end of file diff --git a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.failure.json b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.failure.json deleted file mode 100644 index b5df149..0000000 --- a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.failure.json +++ /dev/null @@ -1 +0,0 @@ -{"index":7,"lineNumber":1,"column":8,"message":"Error: Line 1: Unexpected token ||","description":"Unexpected token ||"} \ No newline at end of file diff --git a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.js b/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.js deleted file mode 100644 index 86d9379..0000000 --- a/test/fixtures/es2020/nullish-coalescing/invalid-nullish-coalescing-chain-or-tail.js +++ /dev/null @@ -1 +0,0 @@ -1 ?? 2 || 3 \ No newline at end of file diff --git a/test/fixtures/expression/binary/multiline_string_literal.js b/test/fixtures/expression/binary/multiline_string_literal.js deleted file mode 100644 index 61869a0..0000000 --- a/test/fixtures/expression/binary/multiline_string_literal.js +++ /dev/null @@ -1,3 +0,0 @@ -var str = 'test \ -d'+'test \ -test'+'f'; diff --git a/test/fixtures/expression/binary/multiline_string_literal.tree.json b/test/fixtures/expression/binary/multiline_string_literal.tree.json deleted file mode 100644 index 433ace0..0000000 --- a/test/fixtures/expression/binary/multiline_string_literal.tree.json +++ /dev/null @@ -1,332 +0,0 @@ - { - "range": [ - 0, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "type": "Program", - "body": [ - { - "range": [ - 0, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "type": "VariableDeclaration", - "declarations": [ - { - "range": [ - 4, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "type": "VariableDeclarator", - "id": { - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "type": "Identifier", - "name": "str" - }, - "init": { - "range": [ - 10, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "type": "BinaryExpression", - "operator": "+", - "left": { - "range": [ - 10, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "type": "BinaryExpression", - "operator": "+", - "left": { - "range": [ - 10, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 2, - "column": 2 - } - }, - "type": "Literal", - "value": "test d", - "raw": "'test \\\r\nd'" - }, - "right": { - "range": [ - 22, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "type": "Literal", - "value": "test test", - "raw": "'test \\\r\ntest'" - } - }, - "right": { - "range": [ - 37, - 40 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "type": "Literal", - "value": "f", - "raw": "'f'" - } - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "type": "Keyword", - "value": "var" - }, - { - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "type": "Identifier", - "value": "str" - }, - { - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "type": "Punctuator", - "value": "=" - }, - { - "range": [ - 10, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 2, - "column": 2 - } - }, - "type": "String", - "value": "'test \\\r\nd'" - }, - { - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - }, - "type": "Punctuator", - "value": "+" - }, - { - "range": [ - 22, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "type": "String", - "value": "'test \\\r\ntest'" - }, - { - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - }, - "type": "Punctuator", - "value": "+" - }, - { - "range": [ - 37, - 40 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "type": "String", - "value": "'f'" - }, - { - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "type": "Punctuator", - "value": ";" - } - ] -} \ No newline at end of file diff --git a/test/fixtures/statement/if/else-declaration-following-classic-for.js b/test/fixtures/statement/if/else-declaration-following-classic-for.js deleted file mode 100644 index 4cc3f8c..0000000 --- a/test/fixtures/statement/if/else-declaration-following-classic-for.js +++ /dev/null @@ -1,6 +0,0 @@ -if (true) - for (1;;) - 1; -else - for (x of y) - 2; diff --git a/test/fixtures/statement/if/else-declaration-following-classic-for.tree.json b/test/fixtures/statement/if/else-declaration-following-classic-for.tree.json deleted file mode 100644 index df445b6..0000000 --- a/test/fixtures/statement/if/else-declaration-following-classic-for.tree.json +++ /dev/null @@ -1,600 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "IfStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 4, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "consequent": { - "type": "ForStatement", - "init": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "test": null, - "update": null, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - "range": [ - 32, - 34 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - "range": [ - 14, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - "alternate": { - "type": "ForOfStatement", - "await": false, - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 9 - } - } - }, - "range": [ - 65, - 67 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 10 - } - } - }, - "range": [ - 44, - 67 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 6, - "column": 10 - } - } - }, - "range": [ - 0, - 67 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 10 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 67 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 10 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "if", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Boolean", - "value": "true", - "range": [ - 4, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "for", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Numeric", - "value": "1", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Numeric", - "value": "1", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - { - "type": "Keyword", - "value": "else", - "range": [ - 35, - 39 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - { - "type": "Keyword", - "value": "for", - "range": [ - 44, - 47 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "of", - "range": [ - 51, - 53 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - { - "type": "Numeric", - "value": "2", - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 10 - } - } - } - ] -} \ No newline at end of file From 6f6d74a2c64ebe0c9c6a98c1cc011c457b91b8eb Mon Sep 17 00:00:00 2001 From: Jeremy Mill Date: Mon, 24 May 2021 17:09:34 -0400 Subject: [PATCH 8/8] roll back more unsupported tests --- test/fixtures/ES6/template-literals/octal-literal.failure.json | 2 +- .../es2017/async/methods/class-async-method-computed.tree.json | 2 +- .../literal/regular-expression/u-flag-valid-range.tree.json | 2 +- .../tolerant-parse/for-of-missing-parenthesis.tree.json | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test/fixtures/ES6/template-literals/octal-literal.failure.json b/test/fixtures/ES6/template-literals/octal-literal.failure.json index 74d4d2e..658b44d 100644 --- a/test/fixtures/ES6/template-literals/octal-literal.failure.json +++ b/test/fixtures/ES6/template-literals/octal-literal.failure.json @@ -1 +1 @@ -{"index":0,"lineNumber":1,"column":4,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file +{"index":3,"lineNumber":1,"column":4,"message":"Error: Line 1: Octal literals are not allowed in template strings.","description":"Octal literals are not allowed in template strings."} \ No newline at end of file diff --git a/test/fixtures/es2017/async/methods/class-async-method-computed.tree.json b/test/fixtures/es2017/async/methods/class-async-method-computed.tree.json index 828868a..8d2e31e 100644 --- a/test/fixtures/es2017/async/methods/class-async-method-computed.tree.json +++ b/test/fixtures/es2017/async/methods/class-async-method-computed.tree.json @@ -46,7 +46,7 @@ } } }, - "computed": true, + "computed": false, "value": { "type": "FunctionExpression", "id": null, diff --git a/test/fixtures/expression/primary/literal/regular-expression/u-flag-valid-range.tree.json b/test/fixtures/expression/primary/literal/regular-expression/u-flag-valid-range.tree.json index 5dd777e..90de9f6 100644 --- a/test/fixtures/expression/primary/literal/regular-expression/u-flag-valid-range.tree.json +++ b/test/fixtures/expression/primary/literal/regular-expression/u-flag-valid-range.tree.json @@ -26,7 +26,7 @@ }, "init": { "type": "Literal", - "value": null, + "value": {}, "raw": "/[\\u{61}-b][\\u0061-b][a-\\u{62}][a-\\u0062]\\u{1ffff}/u", "regex": { "pattern": "[\\u{61}-b][\\u0061-b][a-\\u{62}][a-\\u0062]\\u{1ffff}", diff --git a/test/fixtures/tolerant-parse/for-of-missing-parenthesis.tree.json b/test/fixtures/tolerant-parse/for-of-missing-parenthesis.tree.json index 668b946..4e2312c 100644 --- a/test/fixtures/tolerant-parse/for-of-missing-parenthesis.tree.json +++ b/test/fixtures/tolerant-parse/for-of-missing-parenthesis.tree.json @@ -3,7 +3,6 @@ "body": [ { "type": "ForOfStatement", - "await": false, "left": { "type": "Identifier", "name": "x",