Преглед на файлове

removed classpath from neko debug infos filenames.

Nicolas Cannasse преди 19 години
родител
ревизия
8b67682822
променени са 1 файла, в които са добавени 19 реда и са изтрити 1 реда
  1. 19 1
      genneko.ml

+ 19 - 1
genneko.ml

@@ -30,9 +30,27 @@ type context = {
 let error msg p =
 	raise (Typer.Error (Typer.Custom msg,p))
 
+let files = Hashtbl.create 0
+
 let pos p =
+	let file = (try
+		Hashtbl.find files p.pfile 
+	with Not_found -> try
+		let len = String.length p.pfile in
+		let base = List.find (fun path -> 
+			let l = String.length path in
+			len > l  && String.sub p.pfile 0 l = path
+		) (!Plugin.class_path) in
+		let l = String.length base in
+		let path = String.sub p.pfile l (len - l) in
+		Hashtbl.add files p.pfile path;
+		path
+	with Not_found ->
+		Hashtbl.add files p.pfile p.pfile;
+		p.pfile
+	) in
 	{
-		psource = p.pfile;
+		psource = file;
 		pline = Lexer.get_error_line p;
 	}