Skip to content

Commit

Permalink
[js] Fix type names in debugger (#10894)
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz authored Mar 8, 2023
1 parent e8c3405 commit 6b63b4c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/generators/genjs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1332,15 +1332,17 @@ let generate_class_es3 ctx c =

let p = s_path ctx cl_path in
let dotp = dot_path cl_path in

let added_to_hxClasses = ctx.has_resolveClass && not is_abstract_impl in

if ctx.js_modern || not added_to_hxClasses then
(* Do not add to $hxClasses on same line as declaration to make sure not to trip js debugger *)
(* when it tries to get a string representation of a class. Will be added below *)
if ctx.com.debug || ctx.js_modern || not added_to_hxClasses then
print ctx "%s = " p
else
print ctx "%s = $hxClasses[\"%s\"] = " p dotp;

process_expose c.cl_meta (fun () -> dotp) (fun s -> print ctx "$hx_exports%s = " (path_to_brackets s));
if not ctx.com.debug then
process_expose c.cl_meta (fun () -> dotp) (fun s -> print ctx "$hx_exports%s = " (path_to_brackets s));

if is_abstract_impl then begin
(* abstract implementations only contain static members and don't need to have constructor functions *)
Expand All @@ -1354,11 +1356,17 @@ let generate_class_es3 ctx c =

newline ctx;

if ctx.js_modern && added_to_hxClasses then begin
if (ctx.js_modern || ctx.com.debug) && added_to_hxClasses then begin
print ctx "$hxClasses[\"%s\"] = %s" dotp p;
newline ctx;
end;

if ctx.com.debug then
process_expose c.cl_meta (fun () -> dotp) (fun s -> begin
print ctx "$hx_exports%s = %s" (path_to_brackets s) p;
newline ctx;
end);

if not is_abstract_impl then begin
generate_class___name__ ctx cl_path;
generate_class___isInterface__ ctx c;
Expand Down

0 comments on commit 6b63b4c

Please sign in to comment.