Skip to content

Commit 10af602

Browse files
committed
make [%debugger] runtime free, so that we can use it without depending on runtime
1 parent d92f9a0 commit 10af602

13 files changed

+7290
-7260
lines changed

jscomp/runtime/js.ml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ type +'a t
5252
]}
5353
*)
5454

55-
[@@@warning "-49"]
56-
(* internal types for FFI, these types are not used by normal users *)
55+
[@@@warning "-49"]
56+
(* internal types for FFI, these types are not used by normal users
57+
Absent cmi file when looking up module alias.
58+
*)
5759

5860
(**/**)
5961
module MapperRt = Js_mapperRt
@@ -65,7 +67,7 @@ module Internal = struct
6567
(** Js uncurried function *)
6668

6769
external (!) : 'a t -> 'a = "#unsafe_downgrade"
68-
external debugger : unit -> unit = "#debugger"
70+
6971
external unsafe_downgrade : 'a t -> 'a = "#unsafe_downgrade"
7072

7173
external fn_mk0 : (unit -> 'a0) -> (([`Arity_0], 'a0) fn) = "#fn_mk" "0"

jscomp/syntax/ast_util.ml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,13 @@ let to_method_callback =
293293
let handle_debugger loc (payload : Ast_payload.t) =
294294
match payload with
295295
| PStr [] ->
296-
Parsetree.Pexp_apply
297-
(Exp.ident {txt = Ldot(Ast_literal.Lid.js_internal, Literals.debugger ); loc},
298-
[ Nolabel, Ast_literal.val_unit ~loc ()])
296+
Ast_external_mk.local_external_apply
297+
loc
298+
~pval_prim:["#debugger"]
299+
~pval_type:(Typ.arrow Nolabel (Typ.any ())
300+
(Ast_literal.type_unit ())
301+
)
302+
[Ast_literal.val_unit ~loc ()]
299303
| _ ->
300304
Location.raise_errorf ~loc "bs.debugger does not accept payload"
301305

0 commit comments

Comments
 (0)