Allow expression in class inheritance

Fixes #326
This commit is contained in:
Sheetal Nandi 2016-10-25 16:17:51 -07:00
Родитель a87cde2f4d
Коммит 5d94572a03
7 изменённых файлов: 174 добавлений и 74 удалений

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

@ -417,13 +417,14 @@ repository:
- include: '#comment'
- include: '#class-or-interface-heritage'
- include: '#type-parameters'
- match: ([_$[:alpha:]][_$[:alnum:]]*)\s*(\.)
- match: ([_$[:alpha:]][_$[:alnum:]]*)\s*(\.)(?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)*\s*([,<{]|extends|implements|//|/\*))
captures:
'1': { name: entity.name.type.module.ts }
'2': { name: punctuation.accessor.ts }
- match: '([_$[:alpha:]][_$[:alnum:]]*)'
- match: ([_$[:alpha:]][_$[:alnum:]]*)(?=\s*([,<{]|extends|implements|//|/\*))
captures:
'1': { name: entity.other.inherited-class.ts }
- include: '#expression'
class-or-interface-body:
begin: \{

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

@ -1369,7 +1369,7 @@
</dict>
<dict>
<key>match</key>
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(\.)</string>
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(\.)(?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)*\s*([,&lt;{]|extends|implements|//|/\*))</string>
<key>captures</key>
<dict>
<key>1</key>
@ -1386,7 +1386,7 @@
</dict>
<dict>
<key>match</key>
<string>([_$[:alpha:]][_$[:alnum:]]*)</string>
<string>([_$[:alpha:]][_$[:alnum:]]*)(?=\s*([,&lt;{]|extends|implements|//|/\*))</string>
<key>captures</key>
<dict>
<key>1</key>
@ -1396,6 +1396,10 @@
</dict>
</dict>
</dict>
<dict>
<key>include</key>
<string>#expression</string>
</dict>
</array>
</dict>
<key>class-or-interface-body</key>

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

@ -1373,7 +1373,7 @@
</dict>
<dict>
<key>match</key>
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(\.)</string>
<string>([_$[:alpha:]][_$[:alnum:]]*)\s*(\.)(?=\s*[_$[:alpha:]][_$[:alnum:]]*(\s*\.\s*[_$[:alpha:]][_$[:alnum:]]*)*\s*([,&lt;{]|extends|implements|//|/\*))</string>
<key>captures</key>
<dict>
<key>1</key>
@ -1390,7 +1390,7 @@
</dict>
<dict>
<key>match</key>
<string>([_$[:alpha:]][_$[:alnum:]]*)</string>
<string>([_$[:alpha:]][_$[:alnum:]]*)(?=\s*([,&lt;{]|extends|implements|//|/\*))</string>
<key>captures</key>
<dict>
<key>1</key>
@ -1400,6 +1400,10 @@
</dict>
</dict>
</dict>
<dict>
<key>include</key>
<string>#expression</string>
</dict>
</array>
</dict>
<key>class-or-interface-body</key>

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

@ -568,12 +568,16 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -603,12 +607,16 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -638,12 +646,16 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -673,12 +685,16 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -708,12 +724,16 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -737,8 +757,10 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
@ -747,8 +769,10 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -772,8 +796,10 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -782,8 +808,10 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -807,12 +835,16 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
@ -842,12 +874,16 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -901,8 +937,10 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
@ -911,8 +949,10 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
@ -978,8 +1018,12 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^^
^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
@ -994,8 +1038,12 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^^
^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
@ -1039,11 +1087,11 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -1068,11 +1116,11 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -1097,11 +1145,11 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -1126,11 +1174,11 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -1157,11 +1205,11 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -1184,7 +1232,7 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
@ -1192,7 +1240,7 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -1215,7 +1263,7 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
@ -1223,7 +1271,7 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
@ -1246,11 +1294,11 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
@ -1277,11 +1325,11 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
@ -1318,7 +1366,7 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
@ -1326,7 +1374,7 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts entity.other.inherited-class.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
@ -1371,7 +1419,7 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^
@ -1383,7 +1431,7 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^
source.ts meta.class.ts
source.ts meta.class.ts punctuation.separator.comma.ts
^^
source.ts meta.class.ts comment.block.ts punctuation.definition.comment.ts
^^

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

@ -0,0 +1,38 @@
original file
-----------------------------------
class Bar extends getFoo("baz") {}
-----------------------------------
Grammar: TypeScript.tmLanguage
-----------------------------------
>class Bar extends getFoo("baz") {}
^^^^^
source.ts meta.class.ts storage.type.class.ts
^
source.ts meta.class.ts
^^^
source.ts meta.class.ts entity.name.type.class.ts
^
source.ts meta.class.ts
^^^^^^^
source.ts meta.class.ts storage.modifier.ts
^
source.ts meta.class.ts
^^^^^^
source.ts meta.class.ts entity.name.function.ts
^
source.ts meta.class.ts meta.brace.round.ts
^
source.ts meta.class.ts string.quoted.double.ts punctuation.definition.string.begin.ts
^^^
source.ts meta.class.ts string.quoted.double.ts
^
source.ts meta.class.ts string.quoted.double.ts punctuation.definition.string.end.ts
^
source.ts meta.class.ts meta.brace.round.ts
^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.definition.block.ts
^
source.ts meta.class.ts punctuation.definition.block.ts

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

@ -168,12 +168,16 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts
^^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^^
source.ts meta.class.ts entity.other.inherited-class.ts
^^
source.ts meta.class.ts
^
source.ts meta.class.ts punctuation.separator.comma.ts
^
source.ts meta.class.ts
^^^^^
source.ts meta.class.ts entity.other.inherited-class.ts
^

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

@ -0,0 +1 @@
class Bar extends getFoo("baz") {}