From 962a98da7523403fe9fdd5d7da7c896859db81ef Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Thu, 3 Oct 2019 10:21:09 +0200 Subject: [PATCH] emmit a t_function when no variables are captured --- src/passes/6-transpiler/transpiler.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/passes/6-transpiler/transpiler.ml b/src/passes/6-transpiler/transpiler.ml index 470eb726e..b8017f6b8 100644 --- a/src/passes/6-transpiler/transpiler.ml +++ b/src/passes/6-transpiler/transpiler.ml @@ -232,7 +232,10 @@ and transpile_environment_element_type : AST.environment_element -> type_value r let%bind arg' = transpile_type arg in let%bind env' = transpile_environment ae.environment in let sub_env = Mini_c.Environment.select captured_variables env' in - ok @@ Combinators.t_deep_closure sub_env arg' ret' + if sub_env = [] then + transpile_type ele.type_value + else + ok @@ Combinators.t_deep_closure sub_env arg' ret' | _ -> transpile_type ele.type_value end | _ -> transpile_type ele.type_value