Skip to content

Commit ad15635

Browse files
committed
continue shaking env argument
1 parent 249eda3 commit ad15635

File tree

7 files changed

+46
-79
lines changed

7 files changed

+46
-79
lines changed

jscomp/core/lam_compile_main.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ let compile
215215
Ext_filename.new_extension !Location.input_name ".lambda" in
216216
Ext_fmt.with_file_as_pp f begin fun fmt ->
217217
Format.pp_print_list ~pp_sep:Format.pp_print_newline
218-
(Lam_group.pp_group env) fmt (coerced_input.groups)
218+
Lam_group.pp_group fmt (coerced_input.groups)
219219
end;
220220
in
221221
#end

jscomp/core/lam_group.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ let str_of_kind (kind : Lam_compat.let_kind) =
5454
| StrictOpt -> "o"
5555
| Variable -> "v"
5656

57-
let pp_group env fmt ( x : t) =
57+
let pp_group fmt ( x : t) =
5858
match x with
5959
| Single (kind, id, lam) ->
6060
Format.fprintf fmt "@[let@ %a@ =%s@ @[<hv>%a@]@ @]" Ident.print id (str_of_kind kind)
61-
(Lam_print.env_lambda env) lam
61+
Lam_print.lambda lam
6262
| Recursive lst ->
6363
List.iter (fun (id,lam) ->
6464
Format.fprintf fmt
65-
"@[let %a@ =r@ %a@ @]" Ident.print id (Lam_print.env_lambda env) lam
65+
"@[let %a@ =r@ %a@ @]" Ident.print id Lam_print.lambda lam
6666
) lst
67-
| Nop lam -> Lam_print.env_lambda env fmt lam
67+
| Nop lam -> Lam_print.lambda fmt lam
6868

6969

7070

jscomp/core/lam_group.mli

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ type t =
3838

3939
(** Tricky to be complete *)
4040

41-
val pp_group : Env.t -> Format.formatter -> t -> unit
41+
val pp_group :
42+
Format.formatter ->
43+
t ->
44+
unit
4245

4346
val single :
4447
Lam_compat.let_kind ->

jscomp/core/lam_print.ml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ let get_string ((id : Ident.t), (pos : int)) (env : Env.t) : string =
398398

399399

400400

401-
let lambda use_env env ppf v =
401+
let lambda ppf v =
402402
let rec lam ppf (l : Lam.t) = match l with
403403
| Lvar id ->
404404
Ident.print ppf id
@@ -437,18 +437,10 @@ let lambda use_env env ppf v =
437437
"@[<2>(let@ (@[<hv 1>%a@]" bindings (List.rev args);
438438
fprintf ppf ")@ %a)@]" lam body
439439
| Lprim {
440-
primitive = Pfield (n,_);
440+
primitive = Pfield (n,Fld_module s);
441441
args = [ Lglobal_module id ]
442-
; _} when use_env ->
443-
fprintf ppf "%s.%s/%d" id.name (get_string (id,n) env) n
444-
445-
| Lprim {
446-
primitive = Psetfield (n,_);
447-
args = [ Lglobal_module id ;
448-
e ]
449-
; _} when use_env ->
450-
fprintf ppf "@[<2>(%s.%s/%d <- %a)@]" id.name (get_string (id,n) env) n
451-
lam e
442+
; _} ->
443+
fprintf ppf "%s.%s/%d" id.name s n
452444
| Lprim{primitive = prim; args = largs; _} ->
453445
let lams ppf largs =
454446
List.iter (fun l -> fprintf ppf "@ %a" lam l) largs in
@@ -540,8 +532,6 @@ let lambda use_env env ppf v =
540532

541533
let structured_constant = struct_const
542534

543-
let env_lambda = lambda true
544-
let lambda = lambda false Env.empty
545535

546536
let rec flatten_seq acc (lam : Lam.t) =
547537
match lam with
@@ -579,10 +569,10 @@ let lambda_as_module env ppf (lam : Lam.t) =
579569
(fun (left, l) ->
580570
match left with
581571
| Id { kind = k; id } ->
582-
fprintf ppf "@[<2>%a =%s@ %a@]@." Ident.print id (kind k) (env_lambda env) l
572+
fprintf ppf "@[<2>%a =%s@ %a@]@." Ident.print id (kind k) lambda l
583573
| Nop ->
584574

585-
fprintf ppf "@[<2>%a@]@." (env_lambda env) l
575+
fprintf ppf "@[<2>%a@]@." lambda l
586576
)
587577

588578
@@ List.rev rest
@@ -592,7 +582,7 @@ let lambda_as_module env ppf (lam : Lam.t) =
592582
end
593583
(* | _ -> raise Not_a_module *)
594584
with _ ->
595-
env_lambda env ppf lam;
585+
lambda ppf lam;
596586
fprintf ppf "; lambda-failure"
597587

598588
let seriaize (filename : string) (lam : Lam.t) : unit =

jscomp/core/lam_print.mli

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ val lambda : Format.formatter -> Lam.t -> unit
2626

2727
val primitive: Format.formatter -> Lam_primitive.t -> unit
2828

29-
30-
31-
val env_lambda : Env.t -> Format.formatter -> Lam.t -> unit
32-
3329
val seriaize : string -> Lam.t -> unit
3430

3531
val lambda_to_string : Lam.t -> string

lib/4.02.3/unstable/js_compiler.ml

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -75303,10 +75303,6 @@ val lambda : Format.formatter -> Lam.t -> unit
7530375303

7530475304
val primitive: Format.formatter -> Lam_primitive.t -> unit
7530575305

75306-
75307-
75308-
val env_lambda : Env.t -> Format.formatter -> Lam.t -> unit
75309-
7531075306
val seriaize : string -> Lam.t -> unit
7531175307

7531275308
val lambda_to_string : Lam.t -> string
@@ -75706,7 +75702,7 @@ let get_string ((id : Ident.t), (pos : int)) (env : Env.t) : string =
7570675702

7570775703

7570875704

75709-
let lambda use_env env ppf v =
75705+
let lambda ppf v =
7571075706
let rec lam ppf (l : Lam.t) = match l with
7571175707
| Lvar id ->
7571275708
Ident.print ppf id
@@ -75745,18 +75741,10 @@ let lambda use_env env ppf v =
7574575741
"@[<2>(let@ (@[<hv 1>%a@]" bindings (List.rev args);
7574675742
fprintf ppf ")@ %a)@]" lam body
7574775743
| Lprim {
75748-
primitive = Pfield (n,_);
75744+
primitive = Pfield (n,Fld_module s);
7574975745
args = [ Lglobal_module id ]
75750-
; _} when use_env ->
75751-
fprintf ppf "%s.%s/%d" id.name (get_string (id,n) env) n
75752-
75753-
| Lprim {
75754-
primitive = Psetfield (n,_);
75755-
args = [ Lglobal_module id ;
75756-
e ]
75757-
; _} when use_env ->
75758-
fprintf ppf "@[<2>(%s.%s/%d <- %a)@]" id.name (get_string (id,n) env) n
75759-
lam e
75746+
; _} ->
75747+
fprintf ppf "%s.%s/%d" id.name s n
7576075748
| Lprim{primitive = prim; args = largs; _} ->
7576175749
let lams ppf largs =
7576275750
List.iter (fun l -> fprintf ppf "@ %a" lam l) largs in
@@ -75848,8 +75836,6 @@ let lambda use_env env ppf v =
7584875836

7584975837
let structured_constant = struct_const
7585075838

75851-
let env_lambda = lambda true
75852-
let lambda = lambda false Env.empty
7585375839

7585475840
let rec flatten_seq acc (lam : Lam.t) =
7585575841
match lam with
@@ -75887,10 +75873,10 @@ let lambda_as_module env ppf (lam : Lam.t) =
7588775873
(fun (left, l) ->
7588875874
match left with
7588975875
| Id { kind = k; id } ->
75890-
fprintf ppf "@[<2>%a =%s@ %a@]@." Ident.print id (kind k) (env_lambda env) l
75876+
fprintf ppf "@[<2>%a =%s@ %a@]@." Ident.print id (kind k) lambda l
7589175877
| Nop ->
7589275878

75893-
fprintf ppf "@[<2>%a@]@." (env_lambda env) l
75879+
fprintf ppf "@[<2>%a@]@." lambda l
7589475880
)
7589575881

7589675882
@@ List.rev rest
@@ -75900,7 +75886,7 @@ let lambda_as_module env ppf (lam : Lam.t) =
7590075886
end
7590175887
(* | _ -> raise Not_a_module *)
7590275888
with _ ->
75903-
env_lambda env ppf lam;
75889+
lambda ppf lam;
7590475890
fprintf ppf "; lambda-failure"
7590575891

7590675892
let seriaize (filename : string) (lam : Lam.t) : unit =
@@ -101312,7 +101298,10 @@ type t =
101312101298

101313101299
(** Tricky to be complete *)
101314101300

101315-
val pp_group : Env.t -> Format.formatter -> t -> unit
101301+
val pp_group :
101302+
Format.formatter ->
101303+
t ->
101304+
unit
101316101305

101317101306
val single :
101318101307
Lam_compat.let_kind ->
@@ -101383,17 +101372,17 @@ let str_of_kind (kind : Lam_compat.let_kind) =
101383101372
| StrictOpt -> "o"
101384101373
| Variable -> "v"
101385101374

101386-
let pp_group env fmt ( x : t) =
101375+
let pp_group fmt ( x : t) =
101387101376
match x with
101388101377
| Single (kind, id, lam) ->
101389101378
Format.fprintf fmt "@[let@ %a@ =%s@ @[<hv>%a@]@ @]" Ident.print id (str_of_kind kind)
101390-
(Lam_print.env_lambda env) lam
101379+
Lam_print.lambda lam
101391101380
| Recursive lst ->
101392101381
List.iter (fun (id,lam) ->
101393101382
Format.fprintf fmt
101394-
"@[let %a@ =r@ %a@ @]" Ident.print id (Lam_print.env_lambda env) lam
101383+
"@[let %a@ =r@ %a@ @]" Ident.print id Lam_print.lambda lam
101395101384
) lst
101396-
| Nop lam -> Lam_print.env_lambda env fmt lam
101385+
| Nop lam -> Lam_print.lambda fmt lam
101397101386

101398101387

101399101388

lib/4.02.3/whole_compiler.ml

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66876,10 +66876,6 @@ val lambda : Format.formatter -> Lam.t -> unit
6687666876

6687766877
val primitive: Format.formatter -> Lam_primitive.t -> unit
6687866878

66879-
66880-
66881-
val env_lambda : Env.t -> Format.formatter -> Lam.t -> unit
66882-
6688366879
val seriaize : string -> Lam.t -> unit
6688466880

6688566881
val lambda_to_string : Lam.t -> string
@@ -67279,7 +67275,7 @@ let get_string ((id : Ident.t), (pos : int)) (env : Env.t) : string =
6727967275

6728067276

6728167277

67282-
let lambda use_env env ppf v =
67278+
let lambda ppf v =
6728367279
let rec lam ppf (l : Lam.t) = match l with
6728467280
| Lvar id ->
6728567281
Ident.print ppf id
@@ -67318,18 +67314,10 @@ let lambda use_env env ppf v =
6731867314
"@[<2>(let@ (@[<hv 1>%a@]" bindings (List.rev args);
6731967315
fprintf ppf ")@ %a)@]" lam body
6732067316
| Lprim {
67321-
primitive = Pfield (n,_);
67317+
primitive = Pfield (n,Fld_module s);
6732267318
args = [ Lglobal_module id ]
67323-
; _} when use_env ->
67324-
fprintf ppf "%s.%s/%d" id.name (get_string (id,n) env) n
67325-
67326-
| Lprim {
67327-
primitive = Psetfield (n,_);
67328-
args = [ Lglobal_module id ;
67329-
e ]
67330-
; _} when use_env ->
67331-
fprintf ppf "@[<2>(%s.%s/%d <- %a)@]" id.name (get_string (id,n) env) n
67332-
lam e
67319+
; _} ->
67320+
fprintf ppf "%s.%s/%d" id.name s n
6733367321
| Lprim{primitive = prim; args = largs; _} ->
6733467322
let lams ppf largs =
6733567323
List.iter (fun l -> fprintf ppf "@ %a" lam l) largs in
@@ -67421,8 +67409,6 @@ let lambda use_env env ppf v =
6742167409

6742267410
let structured_constant = struct_const
6742367411

67424-
let env_lambda = lambda true
67425-
let lambda = lambda false Env.empty
6742667412

6742767413
let rec flatten_seq acc (lam : Lam.t) =
6742867414
match lam with
@@ -67460,10 +67446,10 @@ let lambda_as_module env ppf (lam : Lam.t) =
6746067446
(fun (left, l) ->
6746167447
match left with
6746267448
| Id { kind = k; id } ->
67463-
fprintf ppf "@[<2>%a =%s@ %a@]@." Ident.print id (kind k) (env_lambda env) l
67449+
fprintf ppf "@[<2>%a =%s@ %a@]@." Ident.print id (kind k) lambda l
6746467450
| Nop ->
6746567451

67466-
fprintf ppf "@[<2>%a@]@." (env_lambda env) l
67452+
fprintf ppf "@[<2>%a@]@." lambda l
6746767453
)
6746867454

6746967455
@@ List.rev rest
@@ -67473,7 +67459,7 @@ let lambda_as_module env ppf (lam : Lam.t) =
6747367459
end
6747467460
(* | _ -> raise Not_a_module *)
6747567461
with _ ->
67476-
env_lambda env ppf lam;
67462+
lambda ppf lam;
6747767463
fprintf ppf "; lambda-failure"
6747867464

6747967465
let seriaize (filename : string) (lam : Lam.t) : unit =
@@ -91941,7 +91927,10 @@ type t =
9194191927

9194291928
(** Tricky to be complete *)
9194391929

91944-
val pp_group : Env.t -> Format.formatter -> t -> unit
91930+
val pp_group :
91931+
Format.formatter ->
91932+
t ->
91933+
unit
9194591934

9194691935
val single :
9194791936
Lam_compat.let_kind ->
@@ -92012,17 +92001,17 @@ let str_of_kind (kind : Lam_compat.let_kind) =
9201292001
| StrictOpt -> "o"
9201392002
| Variable -> "v"
9201492003

92015-
let pp_group env fmt ( x : t) =
92004+
let pp_group fmt ( x : t) =
9201692005
match x with
9201792006
| Single (kind, id, lam) ->
9201892007
Format.fprintf fmt "@[let@ %a@ =%s@ @[<hv>%a@]@ @]" Ident.print id (str_of_kind kind)
92019-
(Lam_print.env_lambda env) lam
92008+
Lam_print.lambda lam
9202092009
| Recursive lst ->
9202192010
List.iter (fun (id,lam) ->
9202292011
Format.fprintf fmt
92023-
"@[let %a@ =r@ %a@ @]" Ident.print id (Lam_print.env_lambda env) lam
92012+
"@[let %a@ =r@ %a@ @]" Ident.print id Lam_print.lambda lam
9202492013
) lst
92025-
| Nop lam -> Lam_print.env_lambda env fmt lam
92014+
| Nop lam -> Lam_print.lambda fmt lam
9202692015

9202792016

9202892017

0 commit comments

Comments
 (0)