Skip to content

Commit e4b6698

Browse files
committed
Merge from master
2 parents 6596da5 + 3383ceb commit e4b6698

File tree

12 files changed

+300097
-553371
lines changed

12 files changed

+300097
-553371
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,12 @@ examples/desktop
1111
examples/redux
1212
examples/vscode
1313
log.html
14+
15+
# These files would be generated by 'tree-sitter generate' with the default
16+
# settings. We don't want them because there's already a copy at the root.
17+
/tsx/Cargo.toml
18+
/tsx/binding.gyp
19+
/tsx/bindings
20+
/typescript/Cargo.toml
21+
/typescript/binding.gyp
22+
/typescript/bindings

common/corpus/declarations.txt

Lines changed: 150 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ finally {}
188188
body: (statement_block)
189189
handler: (catch_clause
190190
parameter: (identifier)
191-
type: (type_annotation (type_identifier))
191+
type: (type_annotation (predefined_type))
192192
body: (statement_block)
193193
)
194194
finalizer: (finally_clause body: (statement_block))
@@ -620,7 +620,14 @@ class Foo {
620620
(identifier)
621621
(type_annotation (function_type
622622
(formal_parameters)
623-
(union_type (type_identifier) (generic_type (type_identifier) (type_arguments (union_type (type_identifier) (type_identifier))))))))
623+
(union_type
624+
(type_identifier)
625+
(generic_type
626+
(type_identifier)
627+
(type_arguments
628+
(union_type
629+
(type_identifier)
630+
(literal_type (undefined)))))))))
624631
(optional_parameter
625632
(identifier)
626633
(type_annotation (function_type
@@ -877,3 +884,144 @@ export interface I { }
877884
(export_statement (class_declaration (type_identifier) (class_body)))
878885
(export_statement (interface_declaration (type_identifier) (object_type)))
879886
(export_statement (interface_declaration (type_identifier) (object_type))))
887+
888+
=======================================
889+
Classes with generic parameters
890+
=======================================
891+
892+
class A<
893+
B,
894+
C,
895+
> {}
896+
897+
class D extends A<
898+
X,
899+
Y,
900+
> {}
901+
902+
---
903+
904+
(program
905+
(class_declaration
906+
(type_identifier)
907+
(type_parameters (type_parameter (type_identifier)) (type_parameter (type_identifier)))
908+
(class_body))
909+
(class_declaration
910+
(type_identifier)
911+
(class_heritage (extends_clause (generic_type
912+
(type_identifier)
913+
(type_arguments (type_identifier) (type_identifier)))))
914+
(class_body)))
915+
916+
=======================================
917+
Classes with extensions
918+
=======================================
919+
920+
class A extends B<C>(D) implements C {}
921+
export class A extends B<C>(D) implements C {}
922+
923+
class A extends B<C>(D)<E> implements C {}
924+
export class A extends B<C>(D)<E> implements C {}
925+
926+
export class A extends B<C, D> implements C {}
927+
928+
---
929+
930+
(program
931+
(class_declaration
932+
(type_identifier)
933+
(class_heritage
934+
(extends_clause
935+
(functional_extension
936+
(generic_type
937+
(type_identifier)
938+
(type_arguments
939+
(type_identifier)))
940+
(arguments
941+
(identifier))))
942+
(implements_clause
943+
(type_identifier)))
944+
(class_body))
945+
(export_statement
946+
(class_declaration
947+
(type_identifier)
948+
(class_heritage
949+
(extends_clause
950+
(functional_extension
951+
(generic_type
952+
(type_identifier)
953+
(type_arguments
954+
(type_identifier)))
955+
(arguments
956+
(identifier))))
957+
(implements_clause
958+
(type_identifier)))
959+
(class_body)))
960+
(class_declaration
961+
(type_identifier)
962+
(class_heritage
963+
(extends_clause
964+
(functional_extension
965+
(generic_type
966+
(type_identifier)
967+
(type_arguments
968+
(type_identifier)))
969+
(arguments
970+
(identifier))
971+
(type_arguments
972+
(type_identifier))))
973+
(implements_clause
974+
(type_identifier)))
975+
(class_body))
976+
(export_statement
977+
(class_declaration
978+
(type_identifier)
979+
(class_heritage
980+
(extends_clause
981+
(functional_extension
982+
(generic_type
983+
(type_identifier)
984+
(type_arguments
985+
(type_identifier)))
986+
(arguments
987+
(identifier))
988+
(type_arguments
989+
(type_identifier))))
990+
(implements_clause
991+
(type_identifier)))
992+
(class_body)))
993+
(export_statement
994+
(class_declaration
995+
(type_identifier)
996+
(class_heritage
997+
(extends_clause
998+
(generic_type
999+
(type_identifier)
1000+
(type_arguments
1001+
(type_identifier)
1002+
(type_identifier))))
1003+
(implements_clause
1004+
(type_identifier)))
1005+
(class_body))))
1006+
1007+
==========================================================================
1008+
Semicolon is not automatically inserted for method definitions with a body
1009+
==========================================================================
1010+
1011+
class Foo {
1012+
public bar()
1013+
{
1014+
}
1015+
}
1016+
1017+
---
1018+
1019+
(program
1020+
(class_declaration
1021+
(type_identifier)
1022+
(class_body
1023+
(method_definition
1024+
(accessibility_modifier)
1025+
(property_identifier)
1026+
(formal_parameters)
1027+
(statement_block)))))

common/corpus/expressions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ T as {} & { [t: T]: T } & { [g: G]: G }
99
---
1010

1111
(program
12-
(expression_statement (as_expression (identifier) (template_string)))
12+
(expression_statement (as_expression (identifier) (template_literal_type)))
1313
(expression_statement
1414
(as_expression
1515
(identifier)

0 commit comments

Comments
 (0)