File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -718,10 +718,7 @@ module.exports = grammar({
718718
719719 try_expression : $ => seq (
720720 'try' ,
721- choice (
722- $ . block ,
723- $ . primary_expression ,
724- ) ,
721+ $ . expression ,
725722 'catch' ,
726723 '{' ,
727724 repeat ( $ . switch_match ) ,
Original file line number Diff line number Diff line change @@ -1273,6 +1273,12 @@ try switch foo() {
12731273| Js.Exn.Error(obj) => "error"
12741274}
12751275
1276+ try if true {
1277+ call()
1278+ } catch {
1279+ | Not_found => false
1280+ }
1281+
12761282---
12771283
12781284(source_file
@@ -1320,7 +1326,17 @@ try switch foo() {
13201326 (module_identifier))
13211327 (variant_identifier))
13221328 (formal_parameters (value_identifier)))
1323- (sequence_expression (expression_statement (string (string_fragment))))))))
1329+ (sequence_expression (expression_statement (string (string_fragment)))))))
1330+
1331+ (expression_statement
1332+ (try_expression
1333+ (if_expression (true)
1334+ (block
1335+ (expression_statement
1336+ (call_expression (value_identifier) (arguments)))))
1337+ (switch_match
1338+ (variant_pattern (variant_identifier))
1339+ (sequence_expression (expression_statement (false)))))))
13241340
13251341===========================================
13261342Mutation expressions
You can’t perform that action at this time.
0 commit comments