Skip to content

Commit 524fa67

Browse files
committed
discard the hash value in the early stage
FIXME: disable hash collision test
1 parent f712a65 commit 524fa67

File tree

7 files changed

+21
-13
lines changed

7 files changed

+21
-13
lines changed

jscomp/core/js_dump.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ let exp_need_paren (e : J.expression) =
167167

168168
| Raw_js_code {code_info = Exp _}
169169
| Fun _
170-
| Caml_block (_,_,_, (Blk_record _ | Blk_module _ | Blk_poly_var _ | Blk_extension | Blk_record_ext _ | Blk_record_inlined _ | Blk_constructor _ ))
170+
| Caml_block (_,_,_, (Blk_record _ | Blk_module _ | Blk_poly_var | Blk_extension | Blk_record_ext _ | Blk_record_inlined _ | Blk_constructor _ ))
171171
| Object _ -> true
172172
| Raw_js_code {code_info = Stmt _ }
173173
| Length _
@@ -823,9 +823,9 @@ and expression_desc cxt ~(level:int) f x : cxt =
823823
expression_desc cxt ~level f (Object
824824
((Ext_list.combine_array fields el (fun i -> Js_op.Lit i))))
825825

826-
| Caml_block(el,_,_, Blk_poly_var name) ->
826+
| Caml_block(el,_,_, Blk_poly_var ) ->
827827
begin match el with
828-
| [_;value] ->
828+
| [{expression_desc = Str (_,name)};value] ->
829829
expression_desc
830830
cxt
831831
~level

jscomp/core/js_exp_make.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ let dummy_obj ?comment (info : Lam_tag_info.t) : t =
255255
| Blk_module _
256256
| Blk_constructor _
257257
| Blk_record_inlined _
258-
| Blk_poly_var _
258+
| Blk_poly_var
259259
| Blk_extension
260260
| Blk_record_ext _
261261
->

jscomp/core/js_of_lam_variant.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ let eval (arg : J.expression) (dispatches : (Ast_compatible.hash_label * string)
5050
(** arg is a polyvar *)
5151
let eval_as_event (arg : J.expression) (dispatches : (Ast_compatible.hash_label * string) list ) =
5252
match arg.expression_desc with
53-
| Caml_block([_hash; cb], _, _, Blk_poly_var s) when Js_analyzer.no_side_effect_expression cb
53+
| Caml_block([{expression_desc = Str(_,s)}; cb], _, _, Blk_poly_var ) when Js_analyzer.no_side_effect_expression cb
5454
->
5555
let v = Ext_list.assoc_by_string dispatches s None in
5656
Splice2(E.str v , cb )

jscomp/core/lam_compile_util.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ let comment_of_tag_info (x : Lam_tag_info.t) =
4545
| Blk_constructor {name = n} -> Some n
4646
| Blk_tuple -> Some "tuple"
4747
| Blk_class -> Some "class"
48-
| Blk_poly_var _ -> None
48+
| Blk_poly_var -> None
4949
| Blk_record _ -> None
5050
| Blk_record_inlined {name = ctor} -> Some ctor
5151
| Blk_record_ext _ -> None

jscomp/core/lam_constant_convert.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,12 @@ let rec convert_constant ( const : Lambda.structured_constant) : Lam_constant.t
7272
let t : Lam_tag_info.t = Blk_array in
7373
Const_block (i,t, Ext_list.map xs convert_constant )
7474
| Blk_poly_var s ->
75-
let t : Lam_tag_info.t = Blk_poly_var s in
76-
Const_block (i,t, Ext_list.map xs convert_constant )
75+
begin match xs with
76+
| [_; value] ->
77+
let t : Lam_tag_info.t = Blk_poly_var in
78+
Const_block (i,t, [Const_string s; convert_constant value] )
79+
| _ -> assert false
80+
end
7781
| Blk_record s ->
7882
let t : Lam_tag_info.t = Blk_record s in
7983
Const_block (i,t, Ext_list.map xs convert_constant )

jscomp/core/lam_convert.ml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,7 @@ let lam_prim ~primitive:( p : Lambda.primitive) ~args loc : Lam.t =
261261
prim ~primitive:(Pmakeblock (tag,info,mutable_flag)) ~args loc
262262
| Blk_array ->
263263
let info : Lam_tag_info.t = Blk_array in
264-
prim ~primitive:(Pmakeblock (tag,info,mutable_flag)) ~args loc
265-
| Blk_poly_var s ->
266-
let info : Lam_tag_info.t = Blk_poly_var s in
267-
prim ~primitive:(Pmakeblock (tag,info,mutable_flag)) ~args loc
264+
prim ~primitive:(Pmakeblock (tag,info,mutable_flag)) ~args loc
268265
| Blk_record s ->
269266
let info : Lam_tag_info.t = Blk_record s in
270267
prim ~primitive:(Pmakeblock (tag,info,mutable_flag)) ~args loc
@@ -277,6 +274,13 @@ let lam_prim ~primitive:( p : Lambda.primitive) ~args loc : Lam.t =
277274
| Blk_module_export _ ->
278275
let info : Lam_tag_info.t = Blk_module_export in
279276
prim ~primitive:(Pmakeblock (tag,info,mutable_flag)) ~args loc
277+
| Blk_poly_var s ->
278+
begin match args with
279+
| [_; value] ->
280+
let info : Lam_tag_info.t = Blk_poly_var in
281+
prim ~primitive:(Pmakeblock (tag,info,mutable_flag)) ~args:[Lam.const (Const_string s); value] loc
282+
| _ -> assert false
283+
end
280284
| Blk_lazy_general
281285
->
282286
begin match args with

jscomp/core/lam_tag_info.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
type t =
3131
| Blk_tuple
3232
| Blk_array
33-
| Blk_poly_var of string
33+
| Blk_poly_var
3434
| Blk_record of string array
3535
| Blk_module of string list
3636
| Blk_extension

0 commit comments

Comments
 (0)