review
This commit is contained in:
parent
2c62f9d32e
commit
8d59389f7d
@ -342,7 +342,8 @@ and eval : Ast_typed.expression -> env -> value result
|
||||
let {hd;tl;body;tv=_} = cases.match_cons in
|
||||
let env' = Env.extend (Env.extend env (hd,head)) (tl, V_List tail) in
|
||||
eval body env'
|
||||
| Match_variant {cases=[{constructor=Constructor "true";body=match_true};{constructor=Constructor "false"; body=match_false}];_}, V_Ct (C_bool b) ->
|
||||
| Match_variant {cases=[{constructor=Constructor t;body=match_true};{constructor=Constructor f; body=match_false}];_}, V_Ct (C_bool b)
|
||||
when String.equal t "true" && String.equal f "false" ->
|
||||
if b then eval match_true env
|
||||
else eval match_false env
|
||||
| Match_variant {cases ; tv=_} , V_Construct (matched_c , proj) ->
|
||||
|
@ -580,7 +580,8 @@ and transpile_annotated_expression (ae:AST.expression) : expression result =
|
||||
in
|
||||
return @@ E_if_cons (expr' , nil , cons)
|
||||
)
|
||||
| Match_variant {cases=[{constructor=Constructor "true";body=match_true};{constructor=Constructor "false";body=match_false}];_} ->
|
||||
| Match_variant {cases=[{constructor=Constructor t;body=match_true};{constructor=Constructor f;body=match_false}];_}
|
||||
when String.equal t "true" && String.equal f "false" ->
|
||||
let%bind (t , f) = bind_map_pair (transpile_annotated_expression) (match_true, match_false) in
|
||||
return @@ E_if_bool (expr', t, f)
|
||||
| Match_variant {cases ; tv} -> (
|
||||
@ -703,7 +704,8 @@ and transpile_recursive {fun_name; fun_type; lambda} =
|
||||
in
|
||||
return @@ E_if_cons (expr , nil , cons)
|
||||
)
|
||||
| Match_variant {cases=[{constructor=Constructor "true";body=match_true};{constructor=Constructor "false";body=match_false}];_} ->
|
||||
| Match_variant {cases=[{constructor=Constructor t;body=match_true};{constructor=Constructor f;body=match_false}];_}
|
||||
when String.equal t "true" && String.equal f "false" ->
|
||||
let%bind (t , f) = bind_map_pair (replace_callback fun_name loop_type shadowed) (match_true, match_false) in
|
||||
return @@ E_if_bool (expr, t, f)
|
||||
| Match_variant {cases;tv} -> (
|
||||
|
Loading…
Reference in New Issue
Block a user