Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ module.exports = grammar({
[$.parameter, $._pattern],
[$.parameter, $._parenthesized_pattern],
[$._switch_value_pattern, $._parenthesized_pattern],
[$.variant_declaration]
],

rules: {
Expand Down Expand Up @@ -290,7 +291,7 @@ module.exports = grammar({
)),

variant_declaration: $ => prec.right(seq(
optional($.decorator),
repeat($.decorator),
$.variant_identifier,
optional($.variant_parameters),
optional($.type_annotation),
Expand Down Expand Up @@ -498,6 +499,7 @@ module.exports = grammar({
$._definition_signature
),
'=>',
repeat($.decorator),
field('body', $.expression),
)),

Expand Down
16 changes: 15 additions & 1 deletion test/corpus/decorators.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ let foo = (@doesNotRaise String.make)(12, ' ')

let foo = @doesNotRaise String.make(12, ' ')

let onResult = () => @doesNotRaise Belt.Array.getExn([], 0)

---

(source_file
Expand All @@ -52,4 +54,16 @@ let foo = @doesNotRaise String.make(12, ' ')
(value_identifier_path (module_identifier) (value_identifier))
(arguments
(number)
(character)))))
(character))))

(let_binding
(value_identifier)
(function
(formal_parameters)
(decorator (decorator_identifier))
(call_expression
(value_identifier_path (module_identifier) (module_identifier) (value_identifier))
(arguments
(array)
(number))))))