114.29+19

This commit is contained in:
Jeremie Dimino 2017-01-24 16:02:53 +00:00
parent b54a473196
commit c0fcf3607d
2 changed files with 4 additions and 6 deletions

View File

@ -2,5 +2,5 @@
((name ppx_let) ((name ppx_let)
(public_name ppx_let) (public_name ppx_let)
(kind ppx_rewriter) (kind ppx_rewriter)
(libraries (compiler-libs.common ppx_core ppx_driver)) (libraries (ppx_core ppx_driver))
(preprocess no_preprocessing))) (preprocess no_preprocessing)))

View File

@ -1,6 +1,4 @@
open! StdLabels open Ppx_core
open Ppx_core.Std
open Parsetree
open Ast_builder.Default open Ast_builder.Default
module List = struct module List = struct
@ -45,11 +43,11 @@ let expand_with_tmp_vars ~loc bindings expr ~f =
| _ -> | _ ->
let tmp_vars = List.map bindings ~f:(fun _ -> gen_symbol ~prefix:"__let_syntax" ()) in let tmp_vars = List.map bindings ~f:(fun _ -> gen_symbol ~prefix:"__let_syntax" ()) in
let s_rhs_tmp_var (* s/rhs/tmp_var *) = let s_rhs_tmp_var (* s/rhs/tmp_var *) =
List.map2 bindings tmp_vars ~f:(fun vb var -> List.map2_exn bindings tmp_vars ~f:(fun vb var ->
{ vb with pvb_expr = evar ~loc:vb.pvb_expr.pexp_loc var }) { vb with pvb_expr = evar ~loc:vb.pvb_expr.pexp_loc var })
in in
let s_lhs_tmp_var (* s/lhs/tmp_var *) = let s_lhs_tmp_var (* s/lhs/tmp_var *) =
List.map2 bindings tmp_vars ~f:(fun vb var -> List.map2_exn bindings tmp_vars ~f:(fun vb var ->
{ vb with pvb_pat = pvar ~loc:vb.pvb_pat.ppat_loc var }) { vb with pvb_pat = pvar ~loc:vb.pvb_pat.ppat_loc var })
in in
pexp_let ~loc Nonrecursive s_lhs_tmp_var (f ~loc s_rhs_tmp_var expr) pexp_let ~loc Nonrecursive s_lhs_tmp_var (f ~loc s_rhs_tmp_var expr)