Skip to content

Commit e55a071

Browse files
authored
Merge pull request #2707 from BuckleScript/remove_array_copy
remove array_copy
2 parents cd266b9 + ad53305 commit e55a071

28 files changed

+96
-201
lines changed

jscomp/all.depend

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ core/js_of_lam_array.cmi : core/j.cmx
365365
core/js_of_lam_block.cmi : core/js_op.cmx core/j.cmx
366366
core/js_of_lam_string.cmi : core/j.cmx
367367
core/js_of_lam_tuple.cmi : core/j.cmx
368-
core/js_of_lam_record.cmi : core/js_exp_make.cmi core/j.cmx
368+
core/js_of_lam_record.cmi : core/j.cmx
369369
core/js_of_lam_float_record.cmi : core/j.cmx
370370
core/js_arr.cmi : core/j.cmx
371371
core/lam_compile_const.cmi : core/lam.cmi core/j.cmx \
@@ -645,12 +645,11 @@ core/lam_compile_external_obj.cmx : core/lam_compile_external_call.cmx \
645645
core/lam_compile_primitive.cmx : core/lam_print.cmx \
646646
core/lam_dispatch_primitive.cmx core/lam_compile_external_call.cmx \
647647
core/lam_compile_context.cmx core/lam.cmx core/js_runtime_modules.cmx \
648-
core/js_op_util.cmx core/js_of_lam_string.cmx core/js_of_lam_record.cmx \
649-
core/js_of_lam_option.cmx core/js_of_lam_float_record.cmx \
650-
core/js_of_lam_exception.cmx core/js_of_lam_block.cmx \
651-
core/js_of_lam_array.cmx core/js_long.cmx core/js_exp_make.cmx \
652-
common/js_config.cmx core/j.cmx common/bs_warnings.cmx \
653-
core/lam_compile_primitive.cmi
648+
core/js_op_util.cmx core/js_of_lam_string.cmx core/js_of_lam_option.cmx \
649+
core/js_of_lam_float_record.cmx core/js_of_lam_exception.cmx \
650+
core/js_of_lam_block.cmx core/js_of_lam_array.cmx core/js_long.cmx \
651+
core/js_exp_make.cmx common/js_config.cmx core/j.cmx \
652+
common/bs_warnings.cmx core/lam_compile_primitive.cmi
654653
core/lam_compile.cmx : ext/literals.cmx core/lam_util.cmx \
655654
common/lam_methname.cmx core/lam_exit_code.cmx \
656655
core/lam_eta_conversion.cmx core/lam_compile_primitive.cmx \

jscomp/core/j.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ and expression_desc =
104104
| Char_to_int of expression
105105
| Is_null_or_undefined of expression
106106
(** where we use a trick [== null ] *)
107-
| Array_copy of expression (* shallow copy, like [x.slice] *)
108-
109107
| String_append of expression * expression
110108
| Bool of bool (* js true/false*)
111109
(* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence

jscomp/core/js_analyzer.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ let rec no_side_effect_expression_desc (x : J.expression_desc) =
115115
| Bin (op, a, b) ->
116116
op <> Eq && no_side_effect a && no_side_effect b
117117
| Math _
118-
| Array_copy _
119118
| Js_not _
120119
| Cond _
121120

@@ -254,7 +253,6 @@ let rec eq_expression
254253
| Char_of_int _
255254
| Char_to_int _
256255
| Is_null_or_undefined _
257-
| Array_copy _
258256
| String_append _
259257
| Typeof _
260258
| Js_not _

jscomp/core/js_dump.ml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -494,14 +494,6 @@ and
494494
expression 1 cxt f el
495495
)
496496
)
497-
498-
| Array_copy e ->
499-
P.group f 1 (fun _ ->
500-
let cxt = expression 15 cxt f e in
501-
P.string f ".slice";
502-
P.string f "()" ;
503-
cxt
504-
)
505497
| Char_to_int e ->
506498
begin match e.expression_desc with
507499
| String_access (a,b) ->
@@ -1039,7 +1031,6 @@ and statement_desc top cxt f (s : J.statement_desc) : Ext_pp_scope.t =
10391031
| Length _
10401032
| Caml_block_set_length _
10411033
| Call _
1042-
| Array_copy _
10431034
| Caml_block_tag _
10441035
| Seq _
10451036
| Dot _

jscomp/core/js_exp_make.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,6 @@ let char_to_int ?comment (v : t) : t =
441441
| _ -> {comment; expression_desc = Char_to_int v }
442442

443443

444-
let array_copy ?comment e : t =
445-
{ comment ; expression_desc = Array_copy e}
446444

447445
let rec string_append ?comment (e : t) (el : t) : t =
448446
match e.expression_desc , el.expression_desc with

jscomp/core/js_exp_make.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ val function_length : unary_op
146146
val char_of_int : unary_op
147147

148148
val char_to_int : unary_op
149-
val array_copy : unary_op
149+
150150
val string_append : binary_op
151151
(**
152152
When in ES6 mode, we can use Symbol to guarantee its uniquess,

jscomp/core/js_fold.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ class virtual fold =
124124
Qualified (_, Runtime, Some "caml_int_compare")
125125
]}
126126
*)
127-
(** where we use a trick [== null ] *)
128-
(* shallow copy, like [x.slice] *) (* js true/false*)
127+
(** where we use a trick [== null ] *) (* js true/false*)
129128
(* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence
130129
[typeof] is an operator
131130
*)
@@ -320,7 +319,6 @@ class virtual fold =
320319
| Char_of_int _x -> let o = o#expression _x in o
321320
| Char_to_int _x -> let o = o#expression _x in o
322321
| Is_null_or_undefined _x -> let o = o#expression _x in o
323-
| Array_copy _x -> let o = o#expression _x in o
324322
| String_append (_x, _x_i1) ->
325323
let o = o#expression _x in let o = o#expression _x_i1 in o
326324
| Bool _x -> let o = o#bool _x in o

jscomp/core/js_map.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ class virtual map =
137137
Qualified (_, Runtime, Some "caml_int_compare")
138138
]}
139139
*)
140-
(** where we use a trick [== null ] *)
141-
(* shallow copy, like [x.slice] *) (* js true/false*)
140+
(** where we use a trick [== null ] *) (* js true/false*)
142141
(* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence
143142
[typeof] is an operator
144143
*)
@@ -346,7 +345,6 @@ class virtual map =
346345
| Char_to_int _x -> let _x = o#expression _x in Char_to_int _x
347346
| Is_null_or_undefined _x ->
348347
let _x = o#expression _x in Is_null_or_undefined _x
349-
| Array_copy _x -> let _x = o#expression _x in Array_copy _x
350348
| String_append (_x, _x_i1) ->
351349
let _x = o#expression _x in
352350
let _x_i1 = o#expression _x_i1 in String_append (_x, _x_i1)

jscomp/core/js_of_lam_record.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,4 @@ let field field_info e i =
4949
| Lambda.Fld_module s
5050
-> E.index ~comment:s e i
5151

52-
(**
53-
used in [Pduprecord]
54-
this is due to we encode record as an array, it is going to change
55-
if we have another encoding
56-
*)
57-
let copy = E.array_copy
5852

jscomp/core/js_of_lam_record.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,3 @@
3434

3535
val field : Lambda.field_dbg_info -> J.expression -> J.jsint ->J.expression
3636

37-
val copy : Js_exp_make.unary_op

0 commit comments

Comments
 (0)