Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[js] Fix type names in debugger #10894

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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