This commit is contained in:
Pierre-Emmanuel Wulfman 2020-04-23 17:53:10 +02:00
parent ca3549bdee
commit 30f2581f8b
3 changed files with 21 additions and 5 deletions

View File

@ -649,7 +649,7 @@ let rec compile_expression :
let%bind expr = compile_expression c.test in
let%bind match_true = compile_expression c.ifso in
let%bind match_false = compile_expression c.ifnot in
return @@ e_matching ~loc expr (Match_bool {match_true; match_false})
return @@ e_cond ~loc expr match_true match_false
)
and compile_fun lamb' : expr result =

View File

@ -398,7 +398,7 @@ let rec compile_expression (t:Raw.expr) : expr result =
let%bind expr = compile_expression c.test in
let%bind match_true = compile_expression c.ifso in
let%bind match_false = compile_expression c.ifnot in
return @@ e_matching expr ~loc (Match_bool {match_true; match_false})
return @@ e_cond ~loc expr match_true match_false
| ECase c -> (
let (c , loc) = r_split c in
@ -860,7 +860,7 @@ and compile_single_instruction : Raw.instruction -> (_ -> expression result) res
let%bind match_true = match_true None in
let%bind match_false = match_false None in
return_statement @@ e_matching expr ~loc (Match_bool {match_true; match_false})
return_statement @@ e_cond ~loc expr match_true match_false
)
| Assign a -> (
let (a , loc) = r_split a in

View File

@ -52,8 +52,16 @@ let repair_mutable_variable_in_matching (match_body : O.expression) (element_nam
| E_constant {cons_name=C_MAP_FOLD;arguments= _}
| E_constant {cons_name=C_SET_FOLD;arguments= _}
| E_constant {cons_name=C_LIST_FOLD;arguments= _}
| E_cond _
| E_matching _ -> ok @@ (false, (decl_var,free_var),ass_exp)
| _ -> ok (true, (decl_var, free_var),ass_exp)
| E_constant _
| E_skip
| E_literal _ | E_variable _
| E_application _ | E_lambda _| E_recursive _
| E_constructor _ | E_record _| E_record_accessor _|E_record_update _
| E_ascription _ | E_sequence _ | E_tuple _ | E_tuple_accessor _ | E_tuple_update _
| E_map _ | E_big_map _ |E_list _ | E_set _ |E_look_up _
-> ok (true, (decl_var, free_var),ass_exp)
)
(element_names,[])
match_body in
@ -88,8 +96,16 @@ and repair_mutable_variable_in_loops (for_body : O.expression) (element_names :
| E_constant {cons_name=C_MAP_FOLD;arguments= _}
| E_constant {cons_name=C_SET_FOLD;arguments= _}
| E_constant {cons_name=C_LIST_FOLD;arguments= _}
| E_cond _
| E_matching _ -> ok @@ (false,(decl_var,free_var),ass_exp)
| _ -> ok (true,(decl_var, free_var),ass_exp)
| E_constant _
| E_skip
| E_literal _ | E_variable _
| E_application _ | E_lambda _| E_recursive _
| E_constructor _ | E_record _| E_record_accessor _|E_record_update _
| E_ascription _ | E_sequence _ | E_tuple _ | E_tuple_accessor _ | E_tuple_update _
| E_map _ | E_big_map _ |E_list _ | E_set _ |E_look_up _
-> ok (true, (decl_var, free_var),ass_exp)
)
(element_names,[])
for_body in