@@ -43,85 +43,12 @@ let translate loc (prim_name : string) (args : J.expression list) : J.expression
43
43
| None ->
44
44
if prim_name.[0 ] = '?' then
45
45
String. sub prim_name 1 (String. length prim_name - 1 )
46
- else if Ext_string. starts_with prim_name " caml_" then
47
- String. sub prim_name 5 (String. length prim_name - 5 )
48
- else assert false (* prim_name *)
46
+ else prim_name
49
47
| Some x -> x
50
48
in
51
49
E. runtime_call m name args
52
50
in
53
51
match prim_name with
54
- | "caml_notequal" -> (
55
- match args with
56
- | [ a1; b1 ]
57
- when E. for_sure_js_null_undefined a1 || E. for_sure_js_null_undefined b1
58
- ->
59
- E. neq_null_undefined_boolean a1 b1
60
- (* FIXME address_equal *)
61
- | _ ->
62
- Location. prerr_warning loc Warnings. Bs_polymorphic_comparison ;
63
- call Js_runtime_modules. obj_runtime)
64
- | "caml_equal" -> (
65
- match args with
66
- | [ a1; b1 ]
67
- when E. for_sure_js_null_undefined a1 || E. for_sure_js_null_undefined b1
68
- ->
69
- E. eq_null_undefined_boolean a1 b1
70
- (* FIXME address_equal *)
71
- | _ ->
72
- Location. prerr_warning loc Warnings. Bs_polymorphic_comparison ;
73
- call Js_runtime_modules. obj_runtime)
74
- | " caml_min" | " caml_max" | " caml_compare" | " caml_greaterequal"
75
- | " caml_greaterthan" | " caml_lessequal" | " caml_lessthan" | " caml_equal_null"
76
- | "caml_equal_undefined" | "caml_equal_nullable" ->
77
- Location. prerr_warning loc Warnings. Bs_polymorphic_comparison ;
78
- call Js_runtime_modules. obj_runtime
79
- (* generated by the compiler, not user facing *)
80
- | "caml_string_equal" -> (
81
- match args with [ e0; e1 ] -> E. string_equal e0 e1 | _ -> assert false )
82
- | "caml_string_notequal" -> (
83
- match args with
84
- | [ e0; e1 ] -> E. string_comp NotEqEq e0 e1
85
- (* TODO: convert to ocaml ones*)
86
- | _ -> assert false )
87
- | "caml_string_lessequal" -> (
88
- match args with [ e0; e1 ] -> E. string_comp Le e0 e1 | _ -> assert false )
89
- | "caml_string_lessthan" -> (
90
- match args with [ e0; e1 ] -> E. string_comp Lt e0 e1 | _ -> assert false )
91
- | "caml_string_greaterequal" -> (
92
- match args with [ e0; e1 ] -> E. string_comp Ge e0 e1 | _ -> assert false )
93
- | "caml_string_greaterthan" -> (
94
- match args with [ e0; e1 ] -> E. string_comp Gt e0 e1 | _ -> assert false )
95
- | "caml_bool_notequal" -> (
96
- match args with
97
- | [ e0; e1 ] -> E. bool_comp Cneq e0 e1
98
- (* TODO: specialized in OCaml ones*)
99
- | _ -> assert false )
100
- | "caml_bool_lessequal" -> (
101
- match args with [ e0; e1 ] -> E. bool_comp Cle e0 e1 | _ -> assert false )
102
- | "caml_bool_lessthan" -> (
103
- match args with [ e0; e1 ] -> E. bool_comp Clt e0 e1 | _ -> assert false )
104
- | "caml_bool_greaterequal" -> (
105
- match args with [ e0; e1 ] -> E. bool_comp Cge e0 e1 | _ -> assert false )
106
- | "caml_bool_greaterthan" -> (
107
- match args with [ e0; e1 ] -> E. bool_comp Cgt e0 e1 | _ -> assert false )
108
- | " caml_bool_equal" | " caml_bool_equal_null" | " caml_bool_equal_nullable"
109
- | "caml_bool_equal_undefined" -> (
110
- match args with [ e0; e1 ] -> E. bool_comp Ceq e0 e1 | _ -> assert false )
111
- | " caml_int_equal_null" | " caml_int_equal_nullable"
112
- | "caml_int_equal_undefined" -> (
113
- match args with [ e0; e1 ] -> E. int_comp Ceq e0 e1 | _ -> assert false )
114
- | " caml_float_equal_null" | " caml_float_equal_nullable"
115
- | "caml_float_equal_undefined" -> (
116
- match args with [ e0; e1 ] -> E. float_comp Ceq e0 e1 | _ -> assert false )
117
- | " caml_bigint_equal_null" | " caml_bigint_equal_nullable"
118
- | "caml_bigint_equal_undefined" -> (
119
- match args with [ e0; e1 ] -> E. bigint_comp Ceq e0 e1 | _ -> assert false )
120
- | " caml_string_equal_null" | " caml_string_equal_nullable"
121
- | "caml_string_equal_undefined" -> (
122
- match args with
123
- | [ e0; e1 ] -> E. string_comp EqEqEq e0 e1
124
- | _ -> assert false )
125
52
(* *****************************************************************************)
126
53
(* ************************ customized primitives ******************************)
127
54
(* *****************************************************************************)
@@ -136,7 +63,7 @@ let translate loc (prim_name : string) (args : J.expression list) : J.expression
136
63
like normal one to set the identifier *)
137
64
| "?exn_slot_name" | "?is_extension" -> call Js_runtime_modules. exceptions
138
65
| "?as_js_exn" -> call Js_runtime_modules. caml_js_exceptions
139
- | "?obj_dup" -> call Js_runtime_modules. obj_runtime
66
+ | "?obj_dup" -> call Js_runtime_modules. object_
140
67
| "?obj_tag" -> (
141
68
(* Note that in ocaml, [int] has tag [1000] and [string] has tag [252]
142
69
also now we need do nullary check
0 commit comments