Skip to content
Open
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
1 change: 1 addition & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,7 @@ module.exports = grammar({
$._pattern,
$.parameter,
)),
optional(','),
'|',
),

Expand Down
31 changes: 30 additions & 1 deletion test/corpus/expressions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ h(|| -> i { j });
(identifier)))))))

================================================================================
Closures with typed parameteres
Closures with typed parameters
================================================================================

a.map(|b: usize| b.push(c));
Expand All @@ -1284,6 +1284,35 @@ a.map(|b: usize| b.push(c));
(arguments
(identifier))))))))


================================================================================
Closure parameters can have a trailing comma
================================================================================

a.map(|b: usize,| b.push(c));

--------------------------------------------------------------------------------

(source_file
(expression_statement
(call_expression
(field_expression
(identifier)
(field_identifier))
(arguments
(closure_expression
(closure_parameters
(parameter
(identifier)
(primitive_type)))
(call_expression
(field_expression
(identifier)
(field_identifier))
(arguments
(identifier))))))))


================================================================================
Generators
================================================================================
Expand Down