@@ -50,38 +50,32 @@ let dummy =
50
50
51
51
let output_of_expression
52
52
(continuation : continuation )
53
- (should_return : Lam_compile_context.return_type )
54
53
(lam : Lam.t ) (exp : J.expression ) : t =
55
- begin match continuation, should_return with
56
- | EffectCall , ReturnFalse ->
54
+ begin match continuation with
55
+ | EffectCall ReturnFalse ->
57
56
if Lam_analysis. no_side_effects lam
58
57
then dummy
59
58
else {block = [] ; value = Some exp ; output_finished = False }
60
- | Declare (kind , n ), ReturnFalse ->
59
+ | Declare (kind , n )->
61
60
make [ S. define_variable ~kind n exp]
62
- | Assign n , ReturnFalse ->
61
+ | Assign n ->
63
62
make [S. assign n exp ]
64
- | EffectCall , ReturnTrue _ ->
63
+ | EffectCall ( ReturnTrue _ ) ->
65
64
make [S. return_stmt exp] ~output_finished: True
66
- | (Declare _ | Assign _ ), ReturnTrue _ ->
67
- make [S. unknown_lambda lam] ~output_finished: True
68
- | NeedValue , _ ->
65
+ | NeedValue _ ->
69
66
{block = [] ; value = Some exp; output_finished = False }
70
67
end
71
68
72
69
let output_of_block_and_expression
73
70
(continuation : continuation )
74
- (should_return : Lam_compile_context.return_type )
75
- (lam : Lam.t ) (block : J.block ) exp : t =
76
- match continuation, should_return with
77
- | EffectCall , ReturnFalse -> make block ~value: exp
78
- | Declare (kind ,n ), ReturnFalse ->
71
+ (block : J.block ) exp : t =
72
+ match continuation with
73
+ | EffectCall ReturnFalse -> make block ~value: exp
74
+ | Declare (kind ,n ) ->
79
75
make (block @ [ S. define_variable ~kind n exp])
80
- | Assign n , ReturnFalse -> make (block @ [S. assign n exp])
81
- | EffectCall , ReturnTrue _ -> make (block @ [S. return_stmt exp]) ~output_finished: True
82
- | (Declare _ | Assign _ ), ReturnTrue _ ->
83
- make [S. unknown_lambda lam] ~output_finished: True
84
- | NeedValue , (ReturnTrue _ | ReturnFalse ) ->
76
+ | Assign n -> make (block @ [S. assign n exp])
77
+ | EffectCall (ReturnTrue _ ) -> make (block @ [S. return_stmt exp]) ~output_finished: True
78
+ | NeedValue (ReturnTrue _ | ReturnFalse ) ->
85
79
make block ~value: exp
86
80
87
81
0 commit comments