From 0d32416d8d2dc022ae1b525c76162e64377f42ef Mon Sep 17 00:00:00 2001 From: joongwon Date: Mon, 6 Jan 2025 14:17:34 +0900 Subject: [PATCH] add `return` conversion --- lib/js_syntax.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/js_syntax.ml b/lib/js_syntax.ml index e9f32fd..916b600 100644 --- a/lib/js_syntax.ml +++ b/lib/js_syntax.ml @@ -289,7 +289,10 @@ let rec convert_stat_list (body : (Loc.t, Loc.t) Flow_ast.Statement.t list) : | Labeled _ -> (* TODO: handle labeled statement *) (tail, tail_cpl) - | Return _ -> raise NotImplemented + | Return { argument = Some expr; _ } -> + let expr = convert_expr expr in + (expr, CDet CReturn) + | Return { argument = None; _ } -> (Const Unit, CDet CReturn) | Switch _ -> raise NotImplemented | Throw _ -> raise NotImplemented | Try _ -> raise NotImplemented