File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -387,6 +387,16 @@ module.exports = function defineGrammar(dialect) {
387387 choice ( $ . _semicolon , $ . _function_signature_automatic_semicolon ) ,
388388 ) ,
389389
390+ decorator : $ => seq (
391+ '@' ,
392+ choice (
393+ $ . identifier ,
394+ alias ( $ . decorator_member_expression , $ . member_expression ) ,
395+ alias ( $ . decorator_call_expression , $ . call_expression ) ,
396+ alias ( $ . decorator_parenthesized_expression , $ . parenthesized_expression ) ,
397+ ) ,
398+ ) ,
399+
390400 decorator_call_expression : $ => prec ( 'call' , seq (
391401 field ( 'function' , choice (
392402 $ . identifier ,
@@ -396,6 +406,16 @@ module.exports = function defineGrammar(dialect) {
396406 field ( 'arguments' , $ . arguments ) ,
397407 ) ) ,
398408
409+ decorator_parenthesized_expression : $ => seq (
410+ '(' ,
411+ choice (
412+ $ . identifier ,
413+ alias ( $ . decorator_member_expression , $ . member_expression ) ,
414+ alias ( $ . decorator_call_expression , $ . call_expression ) ,
415+ ) ,
416+ ')' ,
417+ ) ,
418+
399419 class_body : $ => seq (
400420 '{' ,
401421 repeat ( choice (
Original file line number Diff line number Diff line change @@ -1189,6 +1189,31 @@ abstract class Foo {
11891189 name: (type_identifier)
11901190 body: (class_body)))
11911191
1192+ =======================================
1193+ Decorator with parenthesized expression
1194+ =======================================
1195+
1196+ class C {
1197+ @(super.decorate)
1198+ method2() { }
1199+ }
1200+
1201+ ---
1202+
1203+ (program
1204+ (class_declaration
1205+ (type_identifier)
1206+ (class_body
1207+ (decorator
1208+ (parenthesized_expression
1209+ (member_expression
1210+ (identifier)
1211+ (property_identifier))))
1212+ (method_definition
1213+ (property_identifier)
1214+ (formal_parameters)
1215+ (statement_block)))))
1216+
11921217==================================
11931218Index type queries
11941219==================================
You can’t perform that action at this time.
0 commit comments