diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-07-11 02:34:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-11 02:34:28 +0800 |
commit | 10a938cb79d19e1476e2744c8651011fd4d7b902 (patch) | |
tree | c92c0e4eb442dacbd9f7a55078e9c220078067b7 | |
parent | 4956ad311b363374211b7767b58b80098bac1ee3 (diff) | |
download | tracifyjs-10a938cb79d19e1476e2744c8651011fd4d7b902.tar.gz tracifyjs-10a938cb79d19e1476e2744c8651011fd4d7b902.zip |
enhance source mapping on IIFEs (#2224)
fixes #2213
-rw-r--r-- | lib/output.js | 3 | ||||
-rw-r--r-- | test/mocha/cli.js | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/output.js b/lib/output.js index 9416583a..6ee96b31 100644 --- a/lib/output.js +++ b/lib/output.js @@ -1104,6 +1104,9 @@ function OutputStream(options) { self.expression.print(output); if (self instanceof AST_New && !need_constructor_parens(self, output)) return; + if (self.expression instanceof AST_Lambda) { + output.add_mapping(self.start); + } output.with_parens(function(){ self.args.forEach(function(expr, i){ if (i) output.comma(); diff --git a/test/mocha/cli.js b/test/mocha/cli.js index 4c4943c6..8bfdc85a 100644 --- a/test/mocha/cli.js +++ b/test/mocha/cli.js @@ -63,7 +63,7 @@ describe("bin/uglifyjs", function () { if (err) throw err; assert.strictEqual(stdout, "var bar=function(){function foo(bar){return bar}return foo}();\n" + - "//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvaW5wdXQvaXNzdWUtMTMyMy9zYW1wbGUuanMiXSwibmFtZXMiOlsiYmFyIiwiZm9vIl0sIm1hcHBpbmdzIjoiQUFBQSxJQUFJQSxJQUFNLFdBQ04sU0FBU0MsSUFBS0QsS0FDVixPQUFPQSxJQUdYLE9BQU9DIn0=\n"); + "//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvaW5wdXQvaXNzdWUtMTMyMy9zYW1wbGUuanMiXSwibmFtZXMiOlsiYmFyIiwiZm9vIl0sIm1hcHBpbmdzIjoiQUFBQSxJQUFJQSxJQUFNLFdBQ04sU0FBU0MsSUFBS0QsS0FDVixPQUFPQSxJQUdYLE9BQU9DLElBTEQifQ==\n"); done(); }); }); @@ -192,7 +192,7 @@ describe("bin/uglifyjs", function () { assert.strictEqual(stdout, [ "var bar=function(){function foo(bar){return bar}return foo}();", - "//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvaW5wdXQvaXNzdWUtMTMyMy9zYW1wbGUuanMiXSwibmFtZXMiOlsiYmFyIiwiZm9vIl0sIm1hcHBpbmdzIjoiQUFBQSxJQUFJQSxJQUFNLFdBQ04sU0FBU0MsSUFBS0QsS0FDVixPQUFPQSxJQUdYLE9BQU9DIn0=", + "//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvaW5wdXQvaXNzdWUtMTMyMy9zYW1wbGUuanMiXSwibmFtZXMiOlsiYmFyIiwiZm9vIl0sIm1hcHBpbmdzIjoiQUFBQSxJQUFJQSxJQUFNLFdBQ04sU0FBU0MsSUFBS0QsS0FDVixPQUFPQSxJQUdYLE9BQU9DLElBTEQifQ==", "", ].join("\n")); assert.strictEqual(stderr, "WARN: inline source map not found\n"); |