From 8d8680a9010f2b2f48f3398605b14628ad33a218 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Sun, 13 Nov 2022 21:50:13 -0300 Subject: [PATCH] feat: support decorated expression statement --- grammar.js | 5 ++++- test/corpus/decorators.txt | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/grammar.js b/grammar.js index 3f3d7d4..c3293cc 100644 --- a/grammar.js +++ b/grammar.js @@ -143,7 +143,10 @@ module.exports = grammar({ _decorated_statement: $ => seq( repeat1($.decorator), - $.declaration, + choice( + $.declaration, + $.expression_statement + ) ), decorator_statement: $ => seq( diff --git a/test/corpus/decorators.txt b/test/corpus/decorators.txt index 6571e02..72020d1 100644 --- a/test/corpus/decorators.txt +++ b/test/corpus/decorators.txt @@ -33,6 +33,9 @@ let foo = @doesNotRaise String.make(12, ' ') let onResult = () => @doesNotRaise Belt.Array.getExn([], 0) +@local +call() + --- (source_file @@ -72,7 +75,13 @@ let onResult = () => @doesNotRaise Belt.Array.getExn([], 0) (value_identifier)) (arguments (array) - (number)))))) + (number))))) + + (decorated + (decorator (decorator_identifier)) + (expression_statement + (call_expression + (value_identifier) (arguments))))) ============================================ Decorator before type `and`