From 075f93ec0dd8a86a87632ac1e2b1aac3b115f7c0 Mon Sep 17 00:00:00 2001 From: Mihai Bazon Date: Tue, 2 Oct 2012 16:39:53 +0300 Subject: [PATCH] line numbers start at 1 --- lib/output.js | 2 +- lib/parse.js | 6 +++--- lib/sourcemap.js | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/output.js b/lib/output.js index d36c9578..cbd97a96 100644 --- a/lib/output.js +++ b/lib/output.js @@ -63,7 +63,7 @@ function OutputStream(options) { var indentation = 0; var current_col = 0; - var current_line = 0; + var current_line = 1; var current_pos = 0; var OUTPUT = ""; diff --git a/lib/parse.js b/lib/parse.js index 115a42ce..b342ca4e 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -246,8 +246,8 @@ function parse_js_number(num) { function JS_Parse_Error(message, line, col, pos) { this.message = message; - this.line = line + 1; - this.col = col + 1; + this.line = line; + this.col = col; this.pos = pos + 1; this.stack = new Error().stack; }; @@ -279,7 +279,7 @@ function tokenizer($TEXT, filename) { filename : filename, pos : 0, tokpos : 0, - line : 0, + line : 1, tokline : 0, col : 0, tokcol : 0, diff --git a/lib/sourcemap.js b/lib/sourcemap.js index a9dc6a81..34299081 100644 --- a/lib/sourcemap.js +++ b/lib/sourcemap.js @@ -56,8 +56,6 @@ function SourceMap(options) { }); var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig); function add(source, gen_line, gen_col, orig_line, orig_col, name) { - orig_line++; - gen_line++; if (orig_map) { var info = orig_map.originalPositionFor({ line: orig_line, -- 2.34.1