Browse Source

[lua] initial wip for sourcemaps

Justin Donaldson 6 years ago
parent
commit
60f57ae060
1 changed files with 19 additions and 1 deletions
  1. 19 1
      src/generators/genlua.ml

+ 19 - 1
src/generators/genlua.ml

@@ -20,13 +20,31 @@
  * DEALINGS IN THE SOFTWARE.
  * DEALINGS IN THE SOFTWARE.
  *)
  *)
 
 
+open Globals
 open Ast
 open Ast
 open Type
 open Type
 open Common
 open Common
 open ExtList
 open ExtList
 open Error
 open Error
 
 
-type pos = Globals.pos
+
+type sourcemap = {
+	sources : (string) DynArray.t;
+	sources_hash : (string, int) Hashtbl.t;
+	mappings : Rbuffer.t;
+
+	mutable source_last_pos : sourcemap_pos;
+	mutable print_comma : bool;
+	mutable output_last_col : int;
+	mutable output_current_col : int;
+	mutable current_expr : sourcemap_pos option;
+}
+
+and sourcemap_pos = {
+	file : int;
+	line : int;
+	col : int;
+}
 
 
 type ctx = {
 type ctx = {
     com : Common.context;
     com : Common.context;