changing the name of the lambda to 'arguments' make its arguments available

This commit is contained in:
Lesenechal Remi 2019-10-27 11:43:51 +01:00
parent 164e88e818
commit a3deccf352
2 changed files with 4 additions and 4 deletions

View File

@ -1054,7 +1054,7 @@ and simpl_for_collect : Raw.for_collect -> (_ -> expression result) result = fun
(* build the X_FOLD constant *)
let lambda = e_lambda "_COMPILER_for_collect_lambda" None None block' in
let lambda = e_lambda "arguments" None None block' in
let%bind collect = simpl_expression fc.expr in
let op_name = match fc.collection with
| Map _ -> "MAP_FOLD"

View File

@ -618,7 +618,7 @@ and type_expression : environment -> ?tv_opt:O.type_value -> I.expression -> O.a
| E_constant ( ("LIST_FOLD"|"MAP_FOLD"|"SET_FOLD") as opname ,
[ collect ;
init_record ;
( { expression = (I.E_lambda { binder = (name, None) ;
( { expression = (I.E_lambda { binder = (lname, None) ;
input_type = None ;
output_type = None ;
result }) ;
@ -636,10 +636,10 @@ and type_expression : environment -> ?tv_opt:O.type_value -> I.expression -> O.a
let input_type = t_tuple (tv_out::[collect_inner_type]) () in
let output_type = Some tv_out in
let e' = Environment.add_ez_binder "arguments" input_type e in
let e' = Environment.add_ez_binder lname input_type e in
let%bind body = type_expression ?tv_opt:output_type e' result in
let output_type = body.type_annotation in
let%bind lambda' = ok @@ make_a_e (E_lambda {binder = name ; body}) (t_function input_type output_type ()) e in
let%bind lambda' = ok @@ make_a_e (E_lambda {binder = lname ; body}) (t_function input_type output_type ()) e in
let%bind lst' = ok @@ lst'@[lambda'] in
let tv_lst = List.map get_type_annotation lst' in