Ver Fonte

anon fields can have @:overload too...

Rudy Ges há 1 ano atrás
pai
commit
34a397e3f6
2 ficheiros alterados com 4 adições e 15 exclusões
  1. 2 9
      src/compiler/hxb/hxbReader.ml
  2. 2 6
      src/compiler/hxb/hxbWriter.ml

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

@@ -241,9 +241,7 @@ class hxb_reader
 			anon_fields.(read_uleb128 ch)
 		| 1 ->
 			let cf = anon_fields.(read_uleb128 ch) in
-			let close = self#open_field_scope in
-			self#read_class_field_data cf;
-			close();
+			self#read_class_field_and_overloads_data cf;
 			cf
 		| _ ->
 			assert false
@@ -1484,12 +1482,7 @@ class hxb_reader
 
 	method read_anfr =
 		let l = read_uleb128 ch in
-		let a = Array.init l (fun i ->
-			let name = self#read_string in
-			let pos = self#read_pos in
-			let name_pos = self#read_pos in
-			{ null_field with cf_name = name; cf_pos = pos; cf_name_pos = name_pos }
-		) in
+		let a = Array.init l (fun _ -> self#read_class_field_forward) in
 		anon_fields <- a
 
 	method read_cflr =

+ 2 - 6
src/compiler/hxb/hxbWriter.ml

@@ -1014,9 +1014,7 @@ class hxb_writer
 			let index = anon_fields#add cf () in
 			IOChunk.write_u8 chunk.io 1;
 			IOChunk.write_uleb128 chunk.io index;
-			let close = self#open_field_scope cf.cf_params in
-			self#write_class_field_data cf;
-			close()
+			self#write_class_field_and_overloads_data cf;
 
 	(* Type instances *)
 
@@ -2113,9 +2111,7 @@ class hxb_writer
 		let items = anon_fields#items in
 		IOChunk.write_uleb128 chunk.io (DynArray.length items);
 		DynArray.iter (fun (cf,_) ->
-			Chunk.write_string chunk cf.cf_name;
-			self#write_pos cf.cf_pos;
-			self#write_pos cf.cf_name_pos;
+			self#write_class_field_forward cf
 		) items;
 
 		self#start_chunk HHDR;