Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae740b933f | ||
|
|
ec7f37f314 | ||
|
|
eb48a035e7 |
@@ -1896,8 +1896,7 @@ merge(Compressor.prototype, {
|
|||||||
if (def.value) def.value = def.value.transform(tt);
|
if (def.value) def.value = def.value.transform(tt);
|
||||||
var sym = def.name.definition();
|
var sym = def.name.definition();
|
||||||
if (sym.id in in_use_ids) return true;
|
if (sym.id in in_use_ids) return true;
|
||||||
if (sym.orig[0] instanceof AST_SymbolCatch
|
if (sym.orig[0] instanceof AST_SymbolCatch) {
|
||||||
&& sym.scope.parent_scope.find_variable(def.name).orig[0] === def.name) {
|
|
||||||
def.value = def.value && def.value.drop_side_effect_free(compressor);
|
def.value = def.value && def.value.drop_side_effect_free(compressor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"homepage": "http://lisperator.net/uglifyjs",
|
"homepage": "http://lisperator.net/uglifyjs",
|
||||||
"author": "Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)",
|
"author": "Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)",
|
||||||
"license": "BSD-2-Clause",
|
"license": "BSD-2-Clause",
|
||||||
"version": "2.8.17",
|
"version": "2.8.18",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.8.0"
|
"node": ">=0.8.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -931,3 +931,30 @@ issue_1715_3: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "1"
|
expect_stdout: "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_1715_4: {
|
||||||
|
options = {
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = 1;
|
||||||
|
!function a() {
|
||||||
|
a++;
|
||||||
|
try {} catch (a) {
|
||||||
|
var a;
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
console.log(a);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = 1;
|
||||||
|
!function() {
|
||||||
|
a++;
|
||||||
|
try {} catch (a) {
|
||||||
|
var a;
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
console.log(a);
|
||||||
|
}
|
||||||
|
expect_stdout: "1"
|
||||||
|
}
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ describe("Directives", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("Should test EXPECT_DIRECTIVE RegExp", function() {
|
it("Should test EXPECT_DIRECTIVE RegExp", function() {
|
||||||
var tests = [
|
[
|
||||||
["", true],
|
["", true],
|
||||||
["'test';", true],
|
["'test';", true],
|
||||||
["'test';;", true],
|
["'test';;", true],
|
||||||
@@ -185,11 +185,12 @@ describe("Directives", function() {
|
|||||||
["'tests'; \n\t", true],
|
["'tests'; \n\t", true],
|
||||||
["'tests';\n\n", true],
|
["'tests';\n\n", true],
|
||||||
["\n\n\"use strict\";\n\n", true]
|
["\n\n\"use strict\";\n\n", true]
|
||||||
];
|
].forEach(function(test) {
|
||||||
|
var out = uglify.OutputStream();
|
||||||
for (var i = 0; i < tests.length; i++) {
|
out.print(test[0]);
|
||||||
assert.strictEqual(uglify.EXPECT_DIRECTIVE.test(tests[i][0]), tests[i][1], tests[i][0]);
|
out.print_string("", null, true);
|
||||||
}
|
assert.strictEqual(out.get() === test[0] + ';""', test[1], test[0]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should only print 2 semicolons spread over 2 lines in beautify mode", function() {
|
it("Should only print 2 semicolons spread over 2 lines in beautify mode", function() {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#! /usr/bin/env node
|
#! /usr/bin/env node
|
||||||
|
|
||||||
global.UGLIFY_DEBUG = true;
|
|
||||||
|
|
||||||
var U = require("../tools/node");
|
var U = require("../tools/node");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
|||||||
@@ -17,7 +17,3 @@ exports["string_template"] = string_template;
|
|||||||
exports["tokenizer"] = tokenizer;
|
exports["tokenizer"] = tokenizer;
|
||||||
exports["is_identifier"] = is_identifier;
|
exports["is_identifier"] = is_identifier;
|
||||||
exports["SymbolDef"] = SymbolDef;
|
exports["SymbolDef"] = SymbolDef;
|
||||||
|
|
||||||
if (global.UGLIFY_DEBUG) {
|
|
||||||
exports["EXPECT_DIRECTIVE"] = EXPECT_DIRECTIVE;
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user