Fixed incorrectly matched destructuring parametes in type declaration.

Fixes #675
This commit is contained in:
Sheetal Nandi 2018-10-29 09:45:45 -07:00
Родитель 8beee84dc9
Коммит 8980e4be2d
5 изменённых файлов: 63 добавлений и 9 удалений

Просмотреть файл

@ -2176,7 +2176,6 @@ repository:
endCaptures:
'0': { name: meta.brace.round.ts }
patterns:
- include: '#destructuring-parameter'
#parameter name only if followed by type annotation
- match: |-
(?x)(?:{{startOfIdentifier}}(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?<!=|:){{startOfIdentifier}}(?:(this)|({{identifier}}))\s*(\??)(?=\s*{{functionLikeType}})

Просмотреть файл

@ -6448,10 +6448,6 @@
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#destructuring-parameter</string>
</dict>
<dict>
<key>match</key>
<string>(?x)(?:(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?&lt;!=|:)(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s*(\??)(?=\s*(:\s*(

Просмотреть файл

@ -6394,10 +6394,6 @@
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#destructuring-parameter</string>
</dict>
<dict>
<key>match</key>
<string>(?x)(?:(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(public|private|protected|readonly)\s+)?(?:(\.\.\.)\s*)?(?&lt;!=|:)(?&lt;![_$[:alnum:]])(?:(?&lt;=\.\.\.)|(?&lt;!\.))(?:(this)|([_$[:alpha:]][_$[:alnum:]]*))\s*(\??)(?=\s*(:\s*(

Просмотреть файл

@ -0,0 +1,62 @@
original file
-----------------------------------
type T = { a: number } & ({ b: number })
-----------------------------------
Grammar: TypeScript.tmLanguage
-----------------------------------
>type T = { a: number } & ({ b: number })
^^^^
source.ts meta.type.declaration.ts storage.type.type.ts
^
source.ts meta.type.declaration.ts
^
source.ts meta.type.declaration.ts entity.name.type.alias.ts
^
source.ts meta.type.declaration.ts
^
source.ts meta.type.declaration.ts keyword.operator.assignment.ts
^
source.ts meta.type.declaration.ts
^
source.ts meta.type.declaration.ts meta.object.type.ts punctuation.definition.block.ts
^
source.ts meta.type.declaration.ts meta.object.type.ts meta.field.declaration.ts
^
source.ts meta.type.declaration.ts meta.object.type.ts meta.field.declaration.ts meta.definition.property.ts variable.object.property.ts
^
source.ts meta.type.declaration.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.type.declaration.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts
^^^^^^
source.ts meta.type.declaration.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts support.type.primitive.ts
^
source.ts meta.type.declaration.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts
^
source.ts meta.type.declaration.ts meta.object.type.ts punctuation.definition.block.ts
^
source.ts meta.type.declaration.ts
^
source.ts meta.type.declaration.ts keyword.operator.type.ts
^
source.ts meta.type.declaration.ts
^
source.ts meta.type.declaration.ts meta.type.paren.cover.ts meta.brace.round.ts
^
source.ts meta.type.declaration.ts meta.type.paren.cover.ts meta.object.type.ts punctuation.definition.block.ts
^
source.ts meta.type.declaration.ts meta.type.paren.cover.ts meta.object.type.ts meta.field.declaration.ts
^
source.ts meta.type.declaration.ts meta.type.paren.cover.ts meta.object.type.ts meta.field.declaration.ts meta.definition.property.ts variable.object.property.ts
^
source.ts meta.type.declaration.ts meta.type.paren.cover.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.type.declaration.ts meta.type.paren.cover.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts
^^^^^^
source.ts meta.type.declaration.ts meta.type.paren.cover.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts support.type.primitive.ts
^
source.ts meta.type.declaration.ts meta.type.paren.cover.ts meta.object.type.ts meta.field.declaration.ts meta.type.annotation.ts
^
source.ts meta.type.declaration.ts meta.type.paren.cover.ts meta.object.type.ts punctuation.definition.block.ts
^
source.ts meta.type.declaration.ts meta.type.paren.cover.ts meta.brace.round.ts

1
tests/cases/Issue675.ts Normal file
Просмотреть файл

@ -0,0 +1 @@
type T = { a: number } & ({ b: number })