diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:10:37 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:11:17 +0200 |
commit | 7a3df06eb573d36142bd1a8e03c5ce8752d300b3 (patch) | |
tree | 70bfaea8884c374876f607774850a3a51c0cb381 /node_modules/uglify-js/bin/uglifyjs | |
parent | aca1143cb9eed16cf37f04e475e4257418dd18ac (diff) |
fix build issues and add typedoc
Diffstat (limited to 'node_modules/uglify-js/bin/uglifyjs')
-rwxr-xr-x | node_modules/uglify-js/bin/uglifyjs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/node_modules/uglify-js/bin/uglifyjs b/node_modules/uglify-js/bin/uglifyjs index 635ca3651..63b2f26f1 100755 --- a/node_modules/uglify-js/bin/uglifyjs +++ b/node_modules/uglify-js/bin/uglifyjs @@ -367,19 +367,19 @@ var index = 0; if (ex instanceof UglifyJS.JS_Parse_Error) { print_error("Parse error at " + file + ":" + ex.line + "," + ex.col); var col = ex.col; - var line = code.split(/\r?\n/)[ex.line - (col ? 1 : 2)]; + var lines = code.split(/\r?\n/); + var line = lines[ex.line - 1]; + if (!line && !col) { + line = lines[ex.line - 2]; + col = line.length; + } if (line) { if (col > 40) { line = line.slice(col - 40); col = 40; } - if (col) { - print_error(line.slice(0, 80)); - print_error(line.slice(0, col).replace(/\S/g, " ") + "^"); - } else { - print_error(line.slice(-40)); - print_error(line.slice(-40).replace(/\S/g, " ") + "^"); - } + print_error(line.slice(0, 80)); + print_error(line.slice(0, col).replace(/\S/g, " ") + "^"); } print_error(ex.stack); process.exit(1); |