@@ -42,22 +42,26 @@ let rec convert_constant (const : Lambda.structured_constant) : Lam_constant.t =
42
42
| Const_false -> Const_js_false
43
43
| Const_true -> Const_js_true
44
44
| Const_pointer (i , p ) -> (
45
- match p with
46
- | Pt_module_alias -> Const_module_alias
47
- | Pt_shape_none -> Lam_constant. lam_none
48
- | Pt_assertfalse -> Const_int {i = Int32. of_int i; comment = Pt_assertfalse }
49
- | Pt_constructor {name; const; non_const; attrs} ->
50
- let tag_type = Ast_untagged_variants. process_tag_type attrs in
51
- Const_int
52
- {
53
- i = Int32. of_int i;
54
- comment =
55
- Pt_constructor {cstr_name = {name; tag_type}; const; non_const};
56
- }
57
- | Pt_variant {name} ->
58
- if Ext_string. is_valid_hash_number name then
59
- Const_int {i = Ext_string. hash_number_as_i32_exn name; comment = None }
60
- else Const_pointer name)
45
+ match p with
46
+ | Pt_module_alias -> Const_module_alias
47
+ | Pt_shape_none -> Lam_constant. lam_none
48
+ | Pt_assertfalse ->
49
+ Const_int { i = Int32. of_int i; comment = Pt_assertfalse }
50
+ | Pt_constructor { name; const; non_const; attrs } ->
51
+ let tag_type = Ast_untagged_variants. process_tag_type attrs in
52
+ let i = match tag_type with
53
+ | Some (Ast_untagged_variants. Int(v )) -> v
54
+ | _ -> i in
55
+ Const_int
56
+ {
57
+ i = Int32. of_int i;
58
+ comment = Pt_constructor { cstr_name= {name; tag_type}; const; non_const };
59
+ }
60
+ | Pt_variant { name } ->
61
+ if Ext_string. is_valid_hash_number name then
62
+ Const_int
63
+ { i = Ext_string. hash_number_as_i32_exn name; comment = None }
64
+ else Const_pointer name)
61
65
| Const_float_array s -> assert false
62
66
| Const_immstring s -> Const_string {s; unicode = false }
63
67
| Const_block (t , xs ) -> (
0 commit comments