emmit a t_function when no variables are captured

This commit is contained in:
Lesenechal Remi 2019-10-03 10:21:09 +02:00
parent 6fbe43d28a
commit 962a98da75

View File

@ -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