Răsfoiți Sursa

fixed struct subclass compilation

Nicolas Cannasse 3 ani în urmă
părinte
comite
3b8c617af6
2 a modificat fișierele cu 5 adăugiri și 2 ștergeri
  1. 1 1
      src/generators/genhl.ml
  2. 4 1
      src/generators/hlcode.ml

+ 1 - 1
src/generators/genhl.ml

@@ -3836,7 +3836,7 @@ let write_code ch code debug =
 			write_index p.pid;
 			(match p.psuper with
 			| None -> write_index (-1)
-			| Some t -> write_type (HObj t));
+			| Some tsup -> write_type (match t with HObj _ -> HObj tsup | _ -> HStruct tsup));
 			(match p.pclassglobal with
 			| None -> write_index 0
 			| Some g -> write_index (g + 1));

+ 4 - 1
src/generators/hlcode.ml

@@ -382,7 +382,10 @@ let gather_types (code:code) =
 	let types = ref PMap.empty in
 	let arr = DynArray.create() in
 	let rec get_type t =
-		(match t with HObj { psuper = Some p } -> get_type (HObj p) | _ -> ());
+		(match t with
+		| HObj { psuper = Some p } -> get_type (HObj p)
+		| HStruct { psuper = Some p } -> get_type (HStruct p)
+		| _ -> ());
 		if PMap.mem t !types then () else
 		let index = DynArray.length arr in
 		DynArray.add arr t;