Read user-defined filename for string based contexts from options.filename

This commit is contained in:
Jaakko-Heikki Heusala 2014-10-08 14:31:39 +03:00
parent a64bdda9ae
commit 4d12f36b2b
2 changed files with 2 additions and 2 deletions

View File

@ -194,7 +194,7 @@ JS_Parse_Error.prototype.toString = function() {
}; };
function js_error(message, filename, line, col, pos) { 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) { function is_token(token, type, val) {

View File

@ -78,7 +78,7 @@ exports.minify = function(files, options) {
: fs.readFileSync(file, "utf8"); : fs.readFileSync(file, "utf8");
sourcesContent[file] = code; sourcesContent[file] = code;
toplevel = UglifyJS.parse(code, { toplevel = UglifyJS.parse(code, {
filename: options.fromString ? "?" : file, filename: options.fromString ? (options.filename ? options.filename : "?") : file,
toplevel: toplevel toplevel: toplevel
}); });
}); });