aboutsummaryrefslogtreecommitdiff
path: root/bin/uglifyjs
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-05-04 20:25:52 +0800
committerGitHub <noreply@github.com>2019-05-04 20:25:52 +0800
commit354fec8a9c3c8540d7e964ecbfcb38deaae86a3e (patch)
treefed20f61e163195ad4d8eb632e79212e6dcb5587 /bin/uglifyjs
parent11cdab745d29313a4e1799c65d13f7d6d5a45938 (diff)
downloadtracifyjs-354fec8a9c3c8540d7e964ecbfcb38deaae86a3e.tar.gz
tracifyjs-354fec8a9c3c8540d7e964ecbfcb38deaae86a3e.zip
make `enclose` & `wrap` work with `sourceMap` (#3396)
fixes #3313
Diffstat (limited to 'bin/uglifyjs')
-rwxr-xr-xbin/uglifyjs34
1 files changed, 18 insertions, 16 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs
index 35207bf7..ace94e7e 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -215,24 +215,26 @@ function run() {
var ex = result.error;
if (ex.name == "SyntaxError") {
print_error("Parse error at " + ex.filename + ":" + ex.line + "," + ex.col);
- var col = ex.col;
- var lines = files[ex.filename].split(/\r?\n/);
- var line = lines[ex.line - 1];
- if (!line && !col) {
- line = lines[ex.line - 2];
- col = line.length;
- }
- if (line) {
- var limit = 70;
- if (col > limit) {
- line = line.slice(col - limit);
- col = limit;
+ var file = files[ex.filename];
+ if (file) {
+ var col = ex.col;
+ var lines = file.split(/\r?\n/);
+ var line = lines[ex.line - 1];
+ if (!line && !col) {
+ line = lines[ex.line - 2];
+ col = line.length;
+ }
+ if (line) {
+ var limit = 70;
+ if (col > limit) {
+ line = line.slice(col - limit);
+ col = limit;
+ }
+ print_error(line.slice(0, 80));
+ print_error(line.slice(0, col).replace(/\S/g, " ") + "^");
}
- print_error(line.slice(0, 80));
- print_error(line.slice(0, col).replace(/\S/g, " ") + "^");
}
- }
- if (ex.defs) {
+ } else if (ex.defs) {
print_error("Supported options:");
print_error(format_object(ex.defs));
}