Browse Source

embrace ttp

Simon Krajewski 1 year ago
parent
commit
85369bef98
2 changed files with 7 additions and 12 deletions
  1. 2 4
      src/compiler/hxb/hxbReader.ml
  2. 5 8
      src/compiler/hxb/hxbWriter.ml

+ 2 - 4
src/compiler/hxb/hxbReader.ml

@@ -757,16 +757,14 @@ class hxb_reader
 		let l = self#read_uleb128 in
 		for i = 0 to l - 1 do
 			let meta = self#read_metadata in
-			let tl1 = self#read_types in
-			let tl2 = self#read_types in
+			let constraints = self#read_types in
 			let def = self#read_option (fun () -> self#read_type_instance) in
 
 			let ttp = a.(i) in
 			let c = ttp.ttp_class in
 			let ttp = a.(i) in
-			ttp.ttp_type <- (TInst(c,tl2));
 			ttp.ttp_default <- def;
-			ttp.ttp_constraints <- Some (Lazy.from_val tl1);
+			ttp.ttp_constraints <- Some (Lazy.from_val constraints);
 			c.cl_meta <- meta;
 			c.cl_kind <- KTypeParameter ttp
 		done;

+ 5 - 8
src/compiler/hxb/hxbWriter.ml

@@ -1161,14 +1161,11 @@ class ['a] hxb_writer
 		self#write_path ttp.ttp_class.cl_path;
 		self#write_pos ttp.ttp_class.cl_name_pos
 
-	method write_type_parameter_data ttp = match follow_lazy ttp.ttp_type with
-		| TInst({cl_kind = KTypeParameter ttp} as c,tl2) ->
-			self#write_metadata c.cl_meta;
-			self#write_types (get_constraints ttp);
-			self#write_types tl2;
-			chunk#write_option ttp.ttp_default self#write_type_instance
-		| _ ->
-			die "" __LOC__
+	method write_type_parameter_data ttp =
+		let c = ttp.ttp_class in
+		self#write_metadata c.cl_meta;
+		self#write_types (get_constraints ttp);
+		chunk#write_option ttp.ttp_default self#write_type_instance
 
 	method write_field_kind = function
 		| Method MethNormal -> chunk#write_byte 0;