From 4d12f36b2b97d403ad89f79b21b788e5fbba96f1 Mon Sep 17 00:00:00 2001 From: Jaakko-Heikki Heusala Date: Wed, 8 Oct 2014 14:31:39 +0300 Subject: [PATCH] Read user-defined filename for string based contexts from options.filename --- lib/parse.js | 2 +- tools/node.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/parse.js b/lib/parse.js index de982b1e..58174878 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -194,7 +194,7 @@ JS_Parse_Error.prototype.toString = function() { }; function js_error(message, filename, line, col, pos) { - throw new JS_Parse_Error(message, line, col, pos); + throw new JS_Parse_Error(''+ message + ' at ' + filename, line, col, pos); }; function is_token(token, type, val) { diff --git a/tools/node.js b/tools/node.js index 084998da..42eb0602 100644 --- a/tools/node.js +++ b/tools/node.js @@ -78,7 +78,7 @@ exports.minify = function(files, options) { : fs.readFileSync(file, "utf8"); sourcesContent[file] = code; toplevel = UglifyJS.parse(code, { - filename: options.fromString ? "?" : file, + filename: options.fromString ? (options.filename ? options.filename : "?") : file, toplevel: toplevel }); });