Skip to content

Commit

Permalink
[hxb] clean abstract fields a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Jul 11, 2023
1 parent 59b5c5f commit 3c9490b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/compiler/hxb/hxbReader.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1167,13 +1167,13 @@ class hxb_reader
(* Printf.eprintf " Read abstract %s\n" (s_type_path a.a_path); *)
self#read_common_module_type m (Obj.magic a);
a.a_impl <- self#read_option (fun () -> self#read_class_ref);
let impl = match a.a_impl with None -> null_class | Some c -> c in
a.a_this <- self#read_type_instance;
a.a_from <- self#read_list (fun () -> self#read_type_instance);
a.a_from_field <- self#read_list (fun () ->
let name = self#read_string in
self#read_type_parameters m ([],name) (fun a -> field_type_parameters <- a);
let t = self#read_type_instance in
let impl = Option.get a.a_impl in
(* Printf.eprintf " Read field ref for abstract from field %s (a = %s)\n" name (s_type_path a.a_path); *)
(* Printf.eprintf " Impl has %d fields and %d statics\n" (List.length impl.cl_ordered_fields) (List.length impl.cl_ordered_statics); *)
let cf = self#read_field_ref (s_type_path impl.cl_path) impl.cl_statics in
Expand All @@ -1184,19 +1184,18 @@ class hxb_reader
let name = self#read_string in
self#read_type_parameters m ([],name) (fun a -> field_type_parameters <- a);
let t = self#read_type_instance in
let impl = Option.get a.a_impl in
(* Printf.eprintf " Read field ref for abstract to field %s (a = %s)\n" name (s_type_path a.a_path); *)
(* Printf.eprintf " Impl has %d fields and %d statics\n" (List.length impl.cl_ordered_fields) (List.length impl.cl_ordered_statics); *)
let cf = self#read_field_ref (s_type_path impl.cl_path) impl.cl_statics in
(* let cf = self#read_field_ref impl.cl_statics in *)
(t,cf)
);

(* TODO check if those work, then remove debug arg *)
a.a_array <- self#read_list (fun () -> self#read_field_ref "TODO" (Option.get a.a_impl).cl_statics);
a.a_read <- self#read_option (fun () -> self#read_field_ref "TODO" (Option.get a.a_impl).cl_fields);
a.a_write <- self#read_option (fun () -> self#read_field_ref "TODO" (Option.get a.a_impl).cl_fields);
a.a_call <- self#read_option (fun () -> self#read_field_ref "TODO" (Option.get a.a_impl).cl_fields);
(* TODO fix those when they don't have expr, then remove debug arg *)
a.a_array <- self#read_list (fun () -> self#read_field_ref (Printf.sprintf "a_array %s" (s_type_path a.a_path)) impl.cl_statics);
a.a_read <- self#read_option (fun () -> self#read_field_ref (Printf.sprintf "a_read %s" (s_type_path a.a_path)) impl.cl_statics);
a.a_write <- self#read_option (fun () -> self#read_field_ref (Printf.sprintf "a_write %s" (s_type_path a.a_path)) impl.cl_statics);
a.a_call <- self#read_option (fun () -> self#read_field_ref (Printf.sprintf "a_call %s" (s_type_path a.a_path)) impl.cl_statics);
a.a_enum <- self#read_bool;

method read_enum (m : module_def) (e : tenum) =
Expand Down

0 comments on commit 3c9490b

Please sign in to comment.