From 67b3e04d134c8014d0eadce41fa814f27343534f Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 7 Oct 2016 13:12:39 -0700 Subject: [PATCH] Support Spread and Rest operator Fixes #291 --- TypeScript.YAML-tmLanguage | 90 ++- TypeScript.tmLanguage | 209 +++-- TypeScriptReact.tmLanguage | 209 +++-- tests/baselines/TsxSamples.baseline.txt | 20 +- tests/baselines/TsxSamples.txt | 8 +- .../restAndSpreadExpression.baseline.txt | 714 ++++++++++++++++++ tests/cases/restAndSpreadExpression.ts | 17 + 7 files changed, 1109 insertions(+), 158 deletions(-) create mode 100644 tests/baselines/restAndSpreadExpression.baseline.txt create mode 100644 tests/cases/restAndSpreadExpression.ts diff --git a/TypeScript.YAML-tmLanguage b/TypeScript.YAML-tmLanguage index ec83a1a..43e22b9 100644 --- a/TypeScript.YAML-tmLanguage +++ b/TypeScript.YAML-tmLanguage @@ -106,8 +106,8 @@ repository: - include: '#array-binding-pattern' - name: variable.other.readwrite.ts match: ([_$[:alpha:]][_$[:alnum:]]*) - - name: variable.other.readwrite.ts - match: ([_$[:alpha:]][_$[:alnum:]]*) + - include: '#object-binding-pattern' + - include: '#destructuring-variable-rest' - include: '#punctuation-comma' array-binding-element: @@ -115,14 +115,20 @@ repository: - include: '#comment' - include: '#object-binding-pattern' - include: '#array-binding-pattern' - - name: variable.other.readwrite.ts - match: ([_$[:alpha:]][_$[:alnum:]]*) + - include: '#destructuring-variable-rest' - include: '#punctuation-comma' + destructuring-variable-rest: + match: (?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*) + captures: + '1': { name: keyword.operator.rest.ts } + '2': { name: variable.other.readwrite.ts } + object-binding-pattern: - begin: \{ + begin: (?:(\.\.\.)\s*)?(\{) beginCaptures: - '0': { name: punctuation.definition.binding-pattern.object.ts } + '1': { name: keyword.operator.rest.ts } + '2': { name: punctuation.definition.binding-pattern.object.ts } end: \} endCaptures: '0': { name: punctuation.definition.binding-pattern.object.ts } @@ -130,9 +136,10 @@ repository: - include: '#object-binding-element' array-binding-pattern: - begin: \[ + begin: (?:(\.\.\.)\s*)?(\[) beginCaptures: - '0': { name: punctuation.definition.binding-pattern.array.ts } + '1': { name: keyword.operator.rest.ts } + '2': { name: punctuation.definition.binding-pattern.array.ts } end: \] endCaptures: '0': { name: punctuation.definition.binding-pattern.array.ts } @@ -171,8 +178,7 @@ repository: - include: '#ternary-expression' - include: '#new-expr' - include: '#object-literal' - - include: '#expression-operator' - - include: '#operators' + - include: '#expression-operators' - include: '#support-objects' - include: '#function-call' - include: '#identifiers' @@ -457,6 +463,12 @@ repository: - include: '#method-declaration' - include: '#indexer-declaration' - include: '#type-annotation' + - begin: \.\.\. + beginCaptures: + '0': { name: keyword.operator.spread.ts } + end: '(?=\}|;|,|$)|(?<=\})' + patterns: + - include: '#type' - include: '#punctuation-comma' - include: '#punctuation-semicolon' @@ -609,7 +621,7 @@ repository: match: '(?:\s*\b(public|private|protected)\b\s+)?(\.\.\.)?\s*(? - name - variable.other.readwrite.ts - match - ([_$[:alpha:]][_$[:alnum:]]*) + include + #object-binding-pattern + + + include + #destructuring-variable-rest include @@ -366,10 +368,8 @@ #array-binding-pattern - name - variable.other.readwrite.ts - match - ([_$[:alpha:]][_$[:alnum:]]*) + include + #destructuring-variable-rest include @@ -377,13 +377,36 @@ + destructuring-variable-rest + + match + (?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + variable.other.readwrite.ts + + + object-binding-pattern begin - \{ + (?:(\.\.\.)\s*)?(\{) beginCaptures - 0 + 1 + + name + keyword.operator.rest.ts + + 2 name punctuation.definition.binding-pattern.object.ts @@ -410,10 +433,15 @@ array-binding-pattern begin - \[ + (?:(\.\.\.)\s*)?(\[) beginCaptures - 0 + 1 + + name + keyword.operator.rest.ts + + 2 name punctuation.definition.binding-pattern.array.ts @@ -541,11 +569,7 @@ include - #expression-operator - - - include - #operators + #expression-operators include @@ -1497,6 +1521,27 @@ include #type-annotation + + begin + \.\.\. + beginCaptures + + 0 + + name + keyword.operator.spread.ts + + + end + (?=\}|;|,|$)|(?<=\}) + patterns + + + include + #type + + + include #punctuation-comma @@ -1994,7 +2039,7 @@ 2 name - keyword.operator.spread.ts + keyword.operator.rest.ts 3 @@ -2121,10 +2166,12 @@ - name - variable.parameter.ts - match - ([_$[:alpha:]][_$[:alnum:]]*) + include + #parameter-object-binding-pattern + + + include + #destructuring-parameter-rest include @@ -2149,10 +2196,8 @@ #parameter-array-binding-pattern - name - variable.parameter.ts - match - ([_$[:alpha:]][_$[:alnum:]]*) + include + #destructuring-parameter-rest include @@ -2160,13 +2205,36 @@ + destructuring-parameter-rest + + match + (?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + keyword.operator.rest.ts + + 2 + + name + variable.parameter.ts + + + parameter-object-binding-pattern begin - \{ + (?:(\.\.\.)\s*)?(\{) beginCaptures - 0 + 1 + + name + keyword.operator.rest.ts + + 2 name punctuation.definition.binding-pattern.object.ts @@ -2193,10 +2261,15 @@ parameter-array-binding-pattern begin - \[ + (?:(\.\.\.)\s*)?(\[) beginCaptures - 0 + 1 + + name + keyword.operator.rest.ts + + 2 name punctuation.definition.binding-pattern.array.ts @@ -2344,10 +2417,6 @@ include #type-builtin-literals - - include - #typeof-operator - include #type-parameters @@ -2362,7 +2431,7 @@ include - #type-operator + #type-operators include @@ -2563,12 +2632,21 @@ - type-operator + type-operators - name - keyword.operator.type.ts - match - [&|] + patterns + + + include + #typeof-operator + + + name + keyword.operator.type.ts + match + [&|] + + type-function-return-type @@ -3722,6 +3800,29 @@ + + name + meta.object.member.ts + begin + \.\.\. + beginCaptures + + 0 + + name + keyword.operator.spread.ts + + + end + (?=,|\}) + patterns + + + include + #expression + + + name meta.object.member.ts @@ -3742,7 +3843,7 @@ - expression-operator + expression-operators patterns @@ -3813,19 +3914,12 @@ - - - typeof-operator - - name - keyword.operator.typeof.ts - match - (?<!\.|\$)\btypeof\b(?!\$) - - operators - - patterns - + + name + keyword.operator.spread.ts + match + \.\.\. + name keyword.operator.assignment.compound.ts @@ -3888,6 +3982,13 @@ + typeof-operator + + name + keyword.operator.typeof.ts + match + (?<!\.|\$)\btypeof\b(?!\$) + arrow-function patterns diff --git a/TypeScriptReact.tmLanguage b/TypeScriptReact.tmLanguage index 6c183fe..b21b26a 100644 --- a/TypeScriptReact.tmLanguage +++ b/TypeScriptReact.tmLanguage @@ -338,10 +338,12 @@ - name - variable.other.readwrite.tsx - match - ([_$[:alpha:]][_$[:alnum:]]*) + include + #object-binding-pattern + + + include + #destructuring-variable-rest include @@ -366,10 +368,8 @@ #array-binding-pattern - name - variable.other.readwrite.tsx - match - ([_$[:alpha:]][_$[:alnum:]]*) + include + #destructuring-variable-rest include @@ -377,13 +377,36 @@ + destructuring-variable-rest + + match + (?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + variable.other.readwrite.tsx + + + object-binding-pattern begin - \{ + (?:(\.\.\.)\s*)?(\{) beginCaptures - 0 + 1 + + name + keyword.operator.rest.tsx + + 2 name punctuation.definition.binding-pattern.object.tsx @@ -410,10 +433,15 @@ array-binding-pattern begin - \[ + (?:(\.\.\.)\s*)?(\[) beginCaptures - 0 + 1 + + name + keyword.operator.rest.tsx + + 2 name punctuation.definition.binding-pattern.array.tsx @@ -545,11 +573,7 @@ include - #expression-operator - - - include - #operators + #expression-operators include @@ -1501,6 +1525,27 @@ include #type-annotation + + begin + \.\.\. + beginCaptures + + 0 + + name + keyword.operator.spread.tsx + + + end + (?=\}|;|,|$)|(?<=\}) + patterns + + + include + #type + + + include #punctuation-comma @@ -1998,7 +2043,7 @@ 2 name - keyword.operator.spread.tsx + keyword.operator.rest.tsx 3 @@ -2125,10 +2170,12 @@ - name - variable.parameter.tsx - match - ([_$[:alpha:]][_$[:alnum:]]*) + include + #parameter-object-binding-pattern + + + include + #destructuring-parameter-rest include @@ -2153,10 +2200,8 @@ #parameter-array-binding-pattern - name - variable.parameter.tsx - match - ([_$[:alpha:]][_$[:alnum:]]*) + include + #destructuring-parameter-rest include @@ -2164,13 +2209,36 @@ + destructuring-parameter-rest + + match + (?:(\.\.\.)\s*)?([_$[:alpha:]][_$[:alnum:]]*) + captures + + 1 + + name + keyword.operator.rest.tsx + + 2 + + name + variable.parameter.tsx + + + parameter-object-binding-pattern begin - \{ + (?:(\.\.\.)\s*)?(\{) beginCaptures - 0 + 1 + + name + keyword.operator.rest.tsx + + 2 name punctuation.definition.binding-pattern.object.tsx @@ -2197,10 +2265,15 @@ parameter-array-binding-pattern begin - \[ + (?:(\.\.\.)\s*)?(\[) beginCaptures - 0 + 1 + + name + keyword.operator.rest.tsx + + 2 name punctuation.definition.binding-pattern.array.tsx @@ -2348,10 +2421,6 @@ include #type-builtin-literals - - include - #typeof-operator - include #type-parameters @@ -2366,7 +2435,7 @@ include - #type-operator + #type-operators include @@ -2567,12 +2636,21 @@ - type-operator + type-operators - name - keyword.operator.type.tsx - match - [&|] + patterns + + + include + #typeof-operator + + + name + keyword.operator.type.tsx + match + [&|] + + type-function-return-type @@ -3704,6 +3782,29 @@ + + name + meta.object.member.tsx + begin + \.\.\. + beginCaptures + + 0 + + name + keyword.operator.spread.tsx + + + end + (?=,|\}) + patterns + + + include + #expression + + + name meta.object.member.tsx @@ -3724,7 +3825,7 @@ - expression-operator + expression-operators patterns @@ -3795,19 +3896,12 @@ - - - typeof-operator - - name - keyword.operator.typeof.tsx - match - (?<!\.|\$)\btypeof\b(?!\$) - - operators - - patterns - + + name + keyword.operator.spread.tsx + match + \.\.\. + name keyword.operator.assignment.compound.tsx @@ -3870,6 +3964,13 @@ + typeof-operator + + name + keyword.operator.typeof.tsx + match + (?<!\.|\$)\btypeof\b(?!\$) + arrow-function patterns diff --git a/tests/baselines/TsxSamples.baseline.txt b/tests/baselines/TsxSamples.baseline.txt index c4ee8ec..61a3c6b 100644 --- a/tests/baselines/TsxSamples.baseline.txt +++ b/tests/baselines/TsxSamples.baseline.txt @@ -572,14 +572,10 @@ Grammar: TypeScriptReact.tmLanguage source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx ^ source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.section.embedded.begin.tsx - ^ - source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx - ^ - source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx - ^ - source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx + ^^^ + source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx keyword.operator.spread.tsx ^^^^^ - source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx variable.other.property.tsx + source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx variable.other.readwrite.tsx ^ source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.section.embedded.end.tsx ^ @@ -645,14 +641,10 @@ Grammar: TypeScriptReact.tmLanguage source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx ^ source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.section.embedded.begin.tsx - ^ - source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx - ^ - source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx - ^ - source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx + ^^^ + source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx keyword.operator.spread.tsx ^^^^^ - source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx variable.other.property.tsx + source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx variable.other.readwrite.tsx ^ source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.section.embedded.end.tsx ^ diff --git a/tests/baselines/TsxSamples.txt b/tests/baselines/TsxSamples.txt index ad4ebea..4a3f422 100644 --- a/tests/baselines/TsxSamples.txt +++ b/tests/baselines/TsxSamples.txt @@ -194,8 +194,8 @@ Grammar: TypeScriptReact.tmLanguage [42, 17]: source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx punctuation.definition.tag.begin.tsx ^^^^^^^^^ [42, 18]: source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx entity.name.tag.tsx - ^ - [42, 29]: source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx + ^^^ + [42, 29]: source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx keyword.operator.spread.tsx ^^ [42, 39]: source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx punctuation.definition.tag.end.tsx > @@ -205,8 +205,8 @@ Grammar: TypeScriptReact.tmLanguage [45, 18]: source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx punctuation.definition.tag.begin.tsx ^^^^^^^^^ [45, 19]: source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx entity.name.tag.tsx - ^ - [45, 30]: source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx punctuation.accessor.tsx + ^^^ + [45, 30]: source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx meta.embedded.expression.tsx keyword.operator.spread.tsx ^^ [45, 57]: source.tsx meta.var.expr.tsx meta.var-single-variable.expr.tsx meta.tag.tsx punctuation.definition.tag.end.tsx > diff --git a/tests/baselines/restAndSpreadExpression.baseline.txt b/tests/baselines/restAndSpreadExpression.baseline.txt new file mode 100644 index 0000000..c3aa772 --- /dev/null +++ b/tests/baselines/restAndSpreadExpression.baseline.txt @@ -0,0 +1,714 @@ +original file +----------------------------------- +function foo(...rest) { +} +// rest +let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 }; +[a, b, ...rest] = [1, 2, 3, 4, 5]; +var { x, ...{ y, z } } = o; +const [x, ...[y, z]] = ['a', 'b', 'c']; +// spread +let n = { x, y, ...z }; +function f(t: T, u: U): { id: string, ...T, ...U } { + return { id: 'id', ...t, ...u }; +} +function myFunction(v, w, x, y, z) { } +var args = [0, 1]; +myFunction(-1, ...args, 2, ...[3]); +var parts = ['shoulders', 'knees']; +var lyrics = ['head', ...parts, 'and', 'toes']; +----------------------------------- + +Grammar: TypeScript.tmLanguage +----------------------------------- +>function foo(...rest) { + ^^^^^^^^ + source.ts meta.function.ts storage.type.function.ts + ^ + source.ts meta.function.ts + ^^^ + source.ts meta.function.ts entity.name.function.ts + ^ + source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts + ^^^ + source.ts meta.function.ts meta.parameters.ts keyword.operator.rest.ts + ^^^^ + source.ts meta.function.ts meta.parameters.ts variable.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts + ^ + source.ts meta.function.ts + ^ + source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts meta.function.ts meta.block.ts +>} + ^ + source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts +>// rest + ^^ + source.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^ + source.ts comment.line.double-slash.ts +>let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 }; + ^^^ + source.ts meta.var.expr.ts storage.type.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts punctuation.definition.binding-pattern.object.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^^^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts keyword.operator.rest.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts punctuation.definition.binding-pattern.object.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts keyword.operator.assignment.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts punctuation.definition.block.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts meta.object-literal.key.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts meta.object-literal.key.ts punctuation.separator.key-value.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts constant.numeric.decimal.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts meta.object-literal.key.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts meta.object-literal.key.ts punctuation.separator.key-value.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts constant.numeric.decimal.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts meta.object-literal.key.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts meta.object-literal.key.ts punctuation.separator.key-value.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts constant.numeric.decimal.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts meta.object-literal.key.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts meta.object-literal.key.ts punctuation.separator.key-value.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts constant.numeric.decimal.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts meta.object.member.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts meta.object-literal.ts punctuation.definition.block.ts + ^ + source.ts punctuation.terminator.statement.ts + ^^ + source.ts +>[a, b, ...rest] = [1, 2, 3, 4, 5]; + ^ + source.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts meta.array.literal.ts variable.other.readwrite.ts + ^ + source.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.array.literal.ts + ^ + source.ts meta.array.literal.ts variable.other.readwrite.ts + ^ + source.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.array.literal.ts + ^^^ + source.ts meta.array.literal.ts keyword.operator.spread.ts + ^^^^ + source.ts meta.array.literal.ts variable.other.readwrite.ts + ^ + source.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts + ^ + source.ts keyword.operator.assignment.ts + ^ + source.ts + ^ + source.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts meta.array.literal.ts constant.numeric.decimal.ts + ^ + source.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.array.literal.ts + ^ + source.ts meta.array.literal.ts constant.numeric.decimal.ts + ^ + source.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.array.literal.ts + ^ + source.ts meta.array.literal.ts constant.numeric.decimal.ts + ^ + source.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.array.literal.ts + ^ + source.ts meta.array.literal.ts constant.numeric.decimal.ts + ^ + source.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.array.literal.ts + ^ + source.ts meta.array.literal.ts constant.numeric.decimal.ts + ^ + source.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts punctuation.terminator.statement.ts + ^^ + source.ts +>var { x, ...{ y, z } } = o; + ^^^ + source.ts meta.var.expr.ts storage.type.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts punctuation.definition.binding-pattern.object.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^^^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts keyword.operator.rest.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts punctuation.definition.binding-pattern.object.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts punctuation.definition.binding-pattern.object.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts punctuation.definition.binding-pattern.object.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts keyword.operator.assignment.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.object-binding-pattern-variable.ts variable.other.readwrite.ts + ^ + source.ts punctuation.terminator.statement.ts + ^^ + source.ts +>const [x, ...[y, z]] = ['a', 'b', 'c']; + ^^^^^ + source.ts meta.var.expr.ts storage.type.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts punctuation.definition.binding-pattern.array.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts + ^^^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts keyword.operator.rest.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts punctuation.definition.binding-pattern.array.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts punctuation.definition.binding-pattern.array.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts punctuation.definition.binding-pattern.array.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts keyword.operator.assignment.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.begin.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts string.quoted.single.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.end.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.begin.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts string.quoted.single.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.end.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.begin.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts string.quoted.single.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.end.ts + ^ + source.ts meta.var.expr.ts meta.array-binding-pattern-variable.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts punctuation.terminator.statement.ts + ^^ + source.ts +>// spread + ^^ + source.ts comment.line.double-slash.ts punctuation.definition.comment.ts + ^^^^^^^^ + source.ts comment.line.double-slash.ts +>let n = { x, y, ...z }; + ^^^ + source.ts meta.var.expr.ts storage.type.ts + ^ + source.ts meta.var.expr.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts keyword.operator.assignment.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.object-literal.ts punctuation.definition.block.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.object-literal.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.object-literal.ts meta.object.member.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.object-literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.object-literal.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.object-literal.ts meta.object.member.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.object-literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.object-literal.ts + ^^^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.object-literal.ts meta.object.member.ts keyword.operator.spread.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.object-literal.ts meta.object.member.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.object-literal.ts meta.object.member.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.object-literal.ts punctuation.definition.block.ts + ^ + source.ts punctuation.terminator.statement.ts + ^^ + source.ts +>function f(t: T, u: U): { id: string, ...T, ...U } { + ^^^^^^^^ + source.ts meta.function.ts storage.type.function.ts + ^ + source.ts meta.function.ts + ^ + source.ts meta.function.ts entity.name.function.ts + ^ + source.ts meta.function.ts meta.type.parameters.ts punctuation.definition.typeparameters.begin.ts + ^ + source.ts meta.function.ts meta.type.parameters.ts entity.name.type.ts + ^ + source.ts meta.function.ts meta.type.parameters.ts punctuation.separator.comma.ts + ^ + source.ts meta.function.ts meta.type.parameters.ts + ^ + source.ts meta.function.ts meta.type.parameters.ts entity.name.type.ts + ^ + source.ts meta.function.ts meta.type.parameters.ts punctuation.definition.typeparameters.end.ts + ^ + source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts + ^ + source.ts meta.function.ts meta.parameters.ts variable.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts + ^ + source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts + ^ + source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts entity.name.type.ts + ^ + source.ts meta.function.ts meta.parameters.ts punctuation.separator.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts + ^ + source.ts meta.function.ts meta.parameters.ts variable.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts + ^ + source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts + ^ + source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts entity.name.type.ts + ^ + source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts + ^ + source.ts meta.function.ts meta.return.type.ts keyword.operator.type.annotation.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts punctuation.definition.block.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts meta.field.declaration.ts + ^^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts meta.field.declaration.ts variable.object.property.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts keyword.operator.type.annotation.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts + ^^^^^^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts support.type.primitive.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts punctuation.separator.comma.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts + ^^^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts keyword.operator.spread.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts entity.name.type.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts punctuation.separator.comma.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts + ^^^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts keyword.operator.spread.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts entity.name.type.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts + ^ + source.ts meta.function.ts meta.return.type.ts meta.object.type.ts punctuation.definition.block.ts + ^ + source.ts meta.function.ts meta.return.type.ts + ^ + source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts meta.function.ts meta.block.ts +> return { id: 'id', ...t, ...u }; + ^^^^ + source.ts meta.function.ts meta.block.ts + ^^^^^^ + source.ts meta.function.ts meta.block.ts keyword.control.flow.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts punctuation.definition.block.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts + ^^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts meta.object.member.ts meta.object-literal.key.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts meta.object.member.ts meta.object-literal.key.ts punctuation.separator.key-value.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts meta.object.member.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts meta.object.member.ts string.quoted.single.ts punctuation.definition.string.begin.ts + ^^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts meta.object.member.ts string.quoted.single.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts meta.object.member.ts string.quoted.single.ts punctuation.definition.string.end.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts + ^^^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts meta.object.member.ts keyword.operator.spread.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts meta.object.member.ts variable.other.readwrite.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts + ^^^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts meta.object.member.ts keyword.operator.spread.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts meta.object.member.ts variable.other.readwrite.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts meta.object.member.ts + ^ + source.ts meta.function.ts meta.block.ts meta.object-literal.ts punctuation.definition.block.ts + ^ + source.ts meta.function.ts meta.block.ts punctuation.terminator.statement.ts + ^^ + source.ts meta.function.ts meta.block.ts +>} + ^ + source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts +>function myFunction(v, w, x, y, z) { } + ^^^^^^^^ + source.ts meta.function.ts storage.type.function.ts + ^ + source.ts meta.function.ts + ^^^^^^^^^^ + source.ts meta.function.ts entity.name.function.ts + ^ + source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts + ^ + source.ts meta.function.ts meta.parameters.ts variable.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts punctuation.separator.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts + ^ + source.ts meta.function.ts meta.parameters.ts variable.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts punctuation.separator.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts + ^ + source.ts meta.function.ts meta.parameters.ts variable.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts punctuation.separator.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts + ^ + source.ts meta.function.ts meta.parameters.ts variable.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts punctuation.separator.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts + ^ + source.ts meta.function.ts meta.parameters.ts variable.parameter.ts + ^ + source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts + ^ + source.ts meta.function.ts + ^ + source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts + ^ + source.ts meta.function.ts meta.block.ts + ^ + source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts + ^^ + source.ts +>var args = [0, 1]; + ^^^ + source.ts meta.var.expr.ts storage.type.ts + ^ + source.ts meta.var.expr.ts + ^^^^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts keyword.operator.assignment.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts constant.numeric.decimal.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts constant.numeric.decimal.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts punctuation.terminator.statement.ts + ^^ + source.ts +>myFunction(-1, ...args, 2, ...[3]); + ^^^^^^^^^^ + source.ts entity.name.function.ts + ^ + source.ts meta.brace.round.ts + ^ + source.ts keyword.operator.arithmetic.ts + ^ + source.ts constant.numeric.decimal.ts + ^ + source.ts punctuation.separator.comma.ts + ^ + source.ts + ^^^ + source.ts keyword.operator.spread.ts + ^^^^ + source.ts variable.other.readwrite.ts + ^ + source.ts punctuation.separator.comma.ts + ^ + source.ts + ^ + source.ts constant.numeric.decimal.ts + ^ + source.ts punctuation.separator.comma.ts + ^ + source.ts + ^^^ + source.ts keyword.operator.spread.ts + ^ + source.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts meta.array.literal.ts constant.numeric.decimal.ts + ^ + source.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts meta.brace.round.ts + ^ + source.ts punctuation.terminator.statement.ts + ^^ + source.ts +>var parts = ['shoulders', 'knees']; + ^^^ + source.ts meta.var.expr.ts storage.type.ts + ^ + source.ts meta.var.expr.ts + ^^^^^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts keyword.operator.assignment.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.begin.ts + ^^^^^^^^^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.end.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.begin.ts + ^^^^^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.end.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts punctuation.terminator.statement.ts + ^^ + source.ts +>var lyrics = ['head', ...parts, 'and', 'toes']; + ^^^ + source.ts meta.var.expr.ts storage.type.ts + ^ + source.ts meta.var.expr.ts + ^^^^^^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts keyword.operator.assignment.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.begin.ts + ^^^^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.end.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts + ^^^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts keyword.operator.spread.ts + ^^^^^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts variable.other.readwrite.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.begin.ts + ^^^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.end.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts punctuation.separator.comma.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.begin.ts + ^^^^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.end.ts + ^ + source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.array.literal.ts meta.brace.square.ts + ^ + source.ts punctuation.terminator.statement.ts \ No newline at end of file diff --git a/tests/cases/restAndSpreadExpression.ts b/tests/cases/restAndSpreadExpression.ts new file mode 100644 index 0000000..520c99e --- /dev/null +++ b/tests/cases/restAndSpreadExpression.ts @@ -0,0 +1,17 @@ +function foo(...rest) { +} +// rest +let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 }; +[a, b, ...rest] = [1, 2, 3, 4, 5]; +var { x, ...{ y, z } } = o; +const [x, ...[y, z]] = ['a', 'b', 'c']; +// spread +let n = { x, y, ...z }; +function f(t: T, u: U): { id: string, ...T, ...U } { + return { id: 'id', ...t, ...u }; +} +function myFunction(v, w, x, y, z) { } +var args = [0, 1]; +myFunction(-1, ...args, 2, ...[3]); +var parts = ['shoulders', 'knees']; +var lyrics = ['head', ...parts, 'and', 'toes']; \ No newline at end of file