From 16ee21d6d096a5cd03841bbb348ead09079c779a Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 10 Dec 2022 16:28:12 +0100 Subject: [PATCH] stop fn on return --- semantics.ml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/semantics.ml b/semantics.ml index a5ba3de..103a98f 100644 --- a/semantics.ml +++ b/semantics.ml @@ -74,8 +74,11 @@ let rec analyze_block env ua ret_t = function | [] -> [], ua | instr :: new_block -> let new_instr, new_env, ua1 = analyze_instr env ua ret_t instr in - let new_block, ua2 = analyze_block new_env ua1 ret_t new_block in - new_instr :: new_block, ua2 + (match new_instr with + | Return _ -> [ new_instr ], ua1 + | _ -> + let new_block, ua2 = analyze_block new_env ua1 ret_t new_block in + new_instr :: new_block, ua2) ;; let analyze_func env ua = function