2
0
Эх сурвалжийг харах

pass current chunk to pos writer

Simon Krajewski 1 жил өмнө
parent
commit
8fb56d52e7

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

@@ -279,7 +279,7 @@ class chunk
 end
 end
 
 
 class pos_writer
 class pos_writer
-	(chunk : chunk)
+	(chunk_initial : chunk)
 	(stats : hxb_writer_stats)
 	(stats : hxb_writer_stats)
 	(p_initial : pos)
 	(p_initial : pos)
 	(write_equal : bool)
 	(write_equal : bool)
@@ -289,17 +289,17 @@ class pos_writer
 	val mutable p_min = p_initial.pmin
 	val mutable p_min = p_initial.pmin
 	val mutable p_max = p_initial.pmax
 	val mutable p_max = p_initial.pmax
 
 
-	method private do_write_pos (p : pos) =
+	method private do_write_pos (chunk : chunk) (p : pos) =
 		incr stats.pos_writes_full;
 		incr stats.pos_writes_full;
 		chunk#write_string p.pfile;
 		chunk#write_string p.pfile;
 		chunk#write_leb128 p.pmin;
 		chunk#write_leb128 p.pmin;
 		chunk#write_leb128 p.pmax;
 		chunk#write_leb128 p.pmax;
 
 
-	method write_pos (offset : int) (p : pos) =
+	method write_pos (chunk : chunk) (offset : int) (p : pos) =
 		if p.pfile != p_file then begin
 		if p.pfile != p_file then begin
 			(* File changed, write full pos *)
 			(* File changed, write full pos *)
 			chunk#write_u8 (4 + offset);
 			chunk#write_u8 (4 + offset);
-			self#do_write_pos p;
+			self#do_write_pos chunk p;
 			p_file <- p.pfile;
 			p_file <- p.pfile;
 			p_min <- p.pmin;
 			p_min <- p.pmin;
 			p_max <- p.pmax;
 			p_max <- p.pmax;
@@ -329,7 +329,7 @@ class pos_writer
 			chunk#write_u8 offset;
 			chunk#write_u8 offset;
 
 
 	initializer
 	initializer
-		self#do_write_pos p_initial
+		self#do_write_pos chunk_initial p_initial
 end
 end
 
 
 let ghetto_bottom_type = TInst({(null_class) with cl_path = ([],"Bottom")},[])
 let ghetto_bottom_type = TInst({(null_class) with cl_path = ([],"Bottom")},[])
@@ -1225,7 +1225,7 @@ class hxb_writer
 		let rec loop e =
 		let rec loop e =
 
 
 			self#write_texpr_type_instance fctx e.etype;
 			self#write_texpr_type_instance fctx e.etype;
-			fctx.pos_writer#write_pos 240 e.epos;
+			fctx.pos_writer#write_pos chunk 240 e.epos;
 
 
 			match e.eexpr with
 			match e.eexpr with
 			(* values 0-19 *)
 			(* values 0-19 *)