Skip to content

Commit 9e0ce8e

Browse files
committed
fix: move decorators inside public field definitions
1 parent 40ddc0d commit 9e0ce8e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

common/define-grammar.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = function defineGrammar(dialect) {
5757
[$.override_modifier, $.primary_expression],
5858
[$.decorator_call_expression, $.decorator],
5959
[$.literal_type, $.pattern],
60-
[$.predefined_type, $.pattern]
60+
[$.predefined_type, $.pattern],
6161
]),
6262

6363
conflicts: ($, previous) => previous.concat([
@@ -119,6 +119,7 @@ module.exports = function defineGrammar(dialect) {
119119

120120
rules: {
121121
public_field_definition: $ => seq(
122+
repeat(field('decorator', $.decorator)),
122123
optional('declare'),
123124
optional($.accessibility_modifier),
124125
choice(
@@ -361,8 +362,11 @@ module.exports = function defineGrammar(dialect) {
361362
class_body: $ => seq(
362363
'{',
363364
repeat(choice(
364-
$.decorator,
365-
seq($.method_definition, optional($._semicolon)),
365+
seq(
366+
repeat(field('decorator', $.decorator)),
367+
$.method_definition,
368+
optional($._semicolon)
369+
),
366370
// As it happens for functions, the semicolon insertion should not
367371
// happen if a block follows the closing paren, because then it's a
368372
// *definition*, not a declaration. Example:

0 commit comments

Comments
 (0)