Skip to content

Commit 645457e

Browse files
committed
rename value into i
1 parent 7f2b91b commit 645457e

13 files changed

+132
-128
lines changed

Diff for: jscomp/core/lam.ml

+17-17
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ and eq_approx_list ls ls1 = Ext_list.for_all2_no_exn ls ls1 eq_approx
418418

419419
let switch lam (lam_switch : lambda_switch) : t =
420420
match lam with
421-
| Lconst ((Const_pointer (i,_) | (Const_int {value = i})))
421+
| Lconst ((Const_pointer (i,_) | (Const_int {i})))
422422
->
423423
Ext_list.assoc_by_int lam_switch.sw_consts i lam_switch.sw_failaction
424424
| Lconst (Const_block (i,_,_)) ->
@@ -485,7 +485,7 @@ let staticraise a b : t = Lstaticraise(a,b)
485485

486486
module Lift = struct
487487
let int i : t =
488-
Lconst ((Const_int {value = i; comment = None}))
488+
Lconst ((Const_int {i; comment = None}))
489489

490490

491491
(* let int32 i : t =
@@ -520,11 +520,11 @@ let prim ~primitive:(prim : Lam_primitive.t) ~args loc : t =
520520
match args with
521521
| [Lconst a] ->
522522
begin match prim, a with
523-
| Pnegint, Const_int {value = a}
524-
-> Lift.int (- a)
523+
| Pnegint, Const_int {i }
524+
-> Lift.int (- i)
525525
(* | Pfloatofint, ( (Const_int a)) *)
526526
(* -> Lift.float (float_of_int a) *)
527-
| Pintoffloat, ( (Const_float a))
527+
| Pintoffloat, Const_float a
528528
->
529529
Lift.int (int_of_float (float_of_string a))
530530
(* | Pnegfloat -> Lift.float (-. a) *)
@@ -561,8 +561,8 @@ let prim ~primitive:(prim : Lam_primitive.t) ~args loc : t =
561561
-> (** FIXME: could raise? *)
562562
Lift.bool (Lam_compat.cmp_float cmp (float_of_string a) (float_of_string b))
563563
| Pintcomp cmp ,
564-
( (Const_int {value = a}) | Const_pointer (a,_)),
565-
( (Const_int {value = b}) | Const_pointer (b,_))
564+
( (Const_int {i = a}) | Const_pointer (a,_)),
565+
( (Const_int {i = b}) | Const_pointer (b,_))
566566
-> Lift.bool (Lam_compat.cmp_int cmp a b)
567567
| (Paddint
568568
| Psubint
@@ -574,7 +574,7 @@ let prim ~primitive:(prim : Lam_primitive.t) ~args loc : t =
574574
| Pxorint
575575
| Plslint
576576
| Plsrint
577-
| Pasrint), (Const_int {value = a}), (Const_int {value = b})
577+
| Pasrint), (Const_int {i = a}), (Const_int {i = b})
578578
->
579579
(* WE SHOULD keep it as [int], to preserve types *)
580580
let aa,bb = Int32.of_int a, Int32.of_int b in
@@ -618,11 +618,11 @@ let prim ~primitive:(prim : Lam_primitive.t) ~args loc : t =
618618
| Pxorbint _ -> Lift.int32 (Int32.logxor aa bb)
619619
| _ -> default ()
620620
end
621-
| Plslbint Pint32, (Const_int32 aa), (Const_int {value = b})
621+
| Plslbint Pint32, (Const_int32 aa), (Const_int {i = b})
622622
-> Lift.int32 (Int32.shift_left aa b )
623-
| Plsrbint Pint32, (Const_int32 aa), (Const_int {value = b})
623+
| Plsrbint Pint32, (Const_int32 aa), (Const_int {i = b})
624624
-> Lift.int32 (Int32.shift_right_logical aa b )
625-
| Pasrbint Pint32, (Const_int32 aa), (Const_int {value = b})
625+
| Pasrbint Pint32, (Const_int32 aa), (Const_int {i = b})
626626
-> Lift.int32 (Int32.shift_right aa b )
627627

628628
| (Paddbint Pint64
@@ -646,11 +646,11 @@ let prim ~primitive:(prim : Lam_primitive.t) ~args loc : t =
646646
| Pxorbint _ -> Lift.int64 (Int64.logxor aa bb)
647647
| _ -> default ()
648648
end
649-
| Plslbint Pint64, (Const_int64 aa), (Const_int {value = b})
649+
| Plslbint Pint64, (Const_int64 aa), (Const_int {i = b})
650650
-> Lift.int64 (Int64.shift_left aa b )
651-
| Plsrbint Pint64, (Const_int64 aa), (Const_int {value = b})
651+
| Plsrbint Pint64, (Const_int64 aa), (Const_int {i = b})
652652
-> Lift.int64 (Int64.shift_right_logical aa b )
653-
| Pasrbint Pint64, (Const_int64 aa), (Const_int {value = b})
653+
| Pasrbint Pint64, (Const_int64 aa), (Const_int {i = b})
654654
-> Lift.int64 (Int64.shift_right aa b )
655655

656656
| Psequand, Const_js_false,
@@ -669,7 +669,7 @@ let prim ~primitive:(prim : Lam_primitive.t) ~args loc : t =
669669
->
670670
Lift.string (a ^ b)
671671
| (Pstringrefs | Pstringrefu), (Const_string(a)),
672-
((Const_int {value = b})| Const_pointer (b,_))
672+
((Const_int {i = b})| Const_pointer (b,_))
673673
->
674674
begin try Lift.char (String.get a b)
675675
with _ -> default ()
@@ -739,7 +739,7 @@ let rec complete_range (sw_consts : (int * _) list) ~(start : int) ~finish=
739739

740740
let rec eval_const_as_bool (v : Lam_constant.t ) : bool =
741741
match v with
742-
| Const_pointer (x, _) | (Const_int {value = x})
742+
| Const_pointer (x, _) | (Const_int {i = x})
743743
->
744744
x <> 0
745745
| (Const_char x) ->
@@ -790,7 +790,7 @@ let if_ (a : t) (b : t) (c : t) : t =
790790
end
791791
| _ ->
792792
(match a with
793-
| Lprim {primitive = Pisout off; args = [Lconst(Const_int {value = range}); Lvar xx] }
793+
| Lprim {primitive = Pisout off; args = [Lconst(Const_int {i = range}); Lvar xx] }
794794
->
795795
begin match c with
796796
| Lswitch ( Lvar yy as switch_arg,

Diff for: jscomp/core/lam_analysis.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
(**used in effect analysis, it is sound but not-complete *)
2727
let not_zero_constant ( x : Lam_constant.t) =
2828
match x with
29-
| Const_int {value } -> value <> 0
29+
| Const_int {i } -> i <> 0
3030
| Const_int32 i -> i <> 0l
3131
| Const_int64 i -> i <> 0L
3232
| Const_nativeint i -> i <> 0n
@@ -62,9 +62,9 @@ let rec no_side_effects (lam : Lam.t) : bool =
6262
| "caml_obj_dup"
6363
| "caml_array_dup"
6464
), _ -> true
65-
| "caml_ml_open_descriptor_in", [Lconst ( (Const_int {value = 0}))] -> true
65+
| "caml_ml_open_descriptor_in", [Lconst ( (Const_int {i = 0}))] -> true
6666
| "caml_ml_open_descriptor_out",
67-
[Lconst ( (Const_int {value = 1|2})) ]
67+
[Lconst ( (Const_int {i = 1|2})) ]
6868
-> true
6969
(* we can not mark it pure
7070
only when we guarantee this exception is caught...

Diff for: jscomp/core/lam_compile.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ and compile_lambda
16501650
| Lfor (id,start,finish,direction,body) ->
16511651
begin match direction,finish with
16521652
| Upto,
1653-
(Lprim {primitive = Psubint ; args = [ new_finish ; Lconst (Const_int {value = 1}) ]} |
1653+
(Lprim {primitive = Psubint ; args = [ new_finish ; Lconst (Const_int {i = 1}) ]} |
16541654
Lprim {primitive = Poffsetint (-1); args = [ new_finish ; ]}
16551655
) ->
16561656
compile_for id start new_finish Up body lambda_cxt

Diff for: jscomp/core/lam_compile_const.ml

+3-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@ and translate (x : Lam_constant.t ) : J.expression =
5757
| Const_js_false -> E.bool false
5858
| Const_js_null -> E.nil
5959
| Const_js_undefined -> E.undefined
60-
| Const_int {value; comment } -> E.int (Int32.of_int value) ?comment
60+
| Const_int {i; comment } -> E.int (Int32.of_int i) ?comment
61+
| Const_int32 i -> E.int i
6162
| Const_char i ->
6263
Js_of_lam_string.const_char i
63-
| Const_int32 i -> E.int i
64+
6465
(* E.float (Int32.to_string i) *)
6566
| Const_int64 i ->
6667
(*

Diff for: jscomp/core/lam_constant.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
| Const_js_undefined
2828
| Const_js_true
2929
| Const_js_false
30-
| Const_int of {value : int; comment : string option}
30+
| Const_int of {i : int; comment : string option}
3131
| Const_char of char
3232
| Const_string of string (* use record later *)
3333
| Const_unicode of string
@@ -53,7 +53,7 @@ let rec eq_approx (x : t) (y : t) =
5353
| Const_js_true -> y = Const_js_true
5454
| Const_js_false -> y = Const_js_false
5555
| Const_int ix ->
56-
(match y with Const_int iy -> ix.value = iy.value | _ -> false)
56+
(match y with Const_int iy -> ix.i = iy.i | _ -> false)
5757
| Const_char ix ->
5858
(match y with Const_char iy -> ix = iy | _ -> false)
5959
| Const_string ix ->

Diff for: jscomp/core/lam_constant.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type t =
2727
| Const_js_undefined
2828
| Const_js_true
2929
| Const_js_false
30-
| Const_int of {value : int; comment : string option}
30+
| Const_int of {i : int; comment : string option}
3131
| Const_char of char
3232
| Const_string of string (* use record later *)
3333
| Const_unicode of string

Diff for: jscomp/core/lam_constant_convert.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
let rec convert_constant ( const : Lambda.structured_constant) : Lam_constant.t =
2626
match const with
27-
| Const_base (Const_int i) -> Const_int {value = i; comment = None}
27+
| Const_base (Const_int i) -> Const_int {i; comment = None}
2828
| Const_base (Const_char i) -> (Const_char i)
2929
| Const_base (Const_string(i,opt)) ->
3030
(match opt with

Diff for: jscomp/core/lam_convert.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,8 @@ let lam_prim ~primitive:( p : Lambda.primitive) ~args loc : Lam.t =
418418
| Pctconst x ->
419419
begin match x with
420420
| Word_size
421-
| Int_size -> Lam.const(Const_int {value = 32; comment = None})
422-
| Max_wosize -> Lam.const (Const_int {value = 2147483647; comment = Some "Max_wosize"})
421+
| Int_size -> Lam.const(Const_int {i = 32; comment = None})
422+
| Max_wosize -> Lam.const (Const_int {i = 2147483647; comment = Some "Max_wosize"})
423423
| Big_endian
424424
-> prim ~primitive:(Pctconst Big_endian) ~args loc
425425
| Ostype_unix
@@ -835,7 +835,7 @@ let convert (exports : Set_ident.t) (lam : Lambda.lambda) : Lam.t * Lam_module_i
835835
| Some i ->
836836
prim
837837
~primitive:Paddint
838-
~args:[e; Lam.const(Const_int {value = i; comment = None})]
838+
~args:[e; Lam.const(Const_int {i; comment = None})]
839839
Location.none
840840
| None ->
841841
Lam.switch e

Diff for: jscomp/core/lam_pass_lets_dce.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ let lets_helper (count_var : Ident.t -> Lam_pass_count.used_info) lam : Lam.t =
205205
| None -> Lam.prim ~primitive ~args:[l';r'] loc
206206
| Some l_s ->
207207
match r with
208-
|Lconst((Const_int {value = i})) ->
208+
|Lconst((Const_int {i})) ->
209209
if i < String.length l_s && i >=0 then
210210
Lam.const ((Const_char l_s.[i]))
211211
else

Diff for: jscomp/core/lam_print.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let rec struct_const ppf (cst : Lam_constant.t) =
2424
| Const_js_null -> fprintf ppf "#null"
2525
| Const_module_alias -> fprintf ppf "#alias"
2626
| Const_js_undefined -> fprintf ppf "#undefined"
27-
| (Const_int {value = n}) -> fprintf ppf "%i" n
27+
| (Const_int {i}) -> fprintf ppf "%i" i
2828
| (Const_char c) -> fprintf ppf "%C" c
2929
| (Const_string s) -> fprintf ppf "%S" s
3030
| (Const_unicode s) -> fprintf ppf "%S" s

0 commit comments

Comments
 (0)