aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/eliminator/eliminator-test-output.js11
-rw-r--r--tools/eliminator/eliminator.coffee6
2 files changed, 5 insertions, 12 deletions
diff --git a/tools/eliminator/eliminator-test-output.js b/tools/eliminator/eliminator-test-output.js
index 05a6fb02..ccbd5e5f 100644
--- a/tools/eliminator/eliminator-test-output.js
+++ b/tools/eliminator/eliminator-test-output.js
@@ -1,18 +1,11 @@
function f() {
-
-
-
-
HEAP[123] = (GLOB[1] + 1) / 2;
}
function g(a1, a2) {
var a = 1;
-
var c = a * 2 - 1;
-
a = c;
foo(c);
-
foo(2);
for (var i = 0; i < 5; i++) {
var q = {
@@ -24,7 +17,6 @@ function g(a1, a2) {
}
var $0 = HEAP[5];
MAYBE_HEAP[myglobal] = 123;
-
if ($0 < 0) {
__label__ = 1;
} else {
@@ -62,7 +54,6 @@ function h() {
x = y ? x + 1 : 7;
var x = -5;
}
-
if (1) {
otherGlob = glob;
breakMe();
@@ -85,8 +76,6 @@ function strtok_part(b, j, f) {
}
}
function py() {
-
-
var $7 = HEAP[HEAP[__PyThreadState_Current] + 12] + 1;
var $8 = HEAP[__PyThreadState_Current] + 12;
HEAP[$8] = $7;
diff --git a/tools/eliminator/eliminator.coffee b/tools/eliminator/eliminator.coffee
index 874ae8d9..62e7ef82 100644
--- a/tools/eliminator/eliminator.coffee
+++ b/tools/eliminator/eliminator.coffee
@@ -395,7 +395,11 @@ main = ->
# NOTE: For large file, can't generate code for the whole file in a single
# call due to the v8 memory limit. Writing out root children instead.
for node in ast[1]
- process.stdout.write uglify.uglify.gen_code node, GEN_OPTIONS
+ # Parse and recompile again, to remove unneeded lines
+ src2 = uglify.uglify.gen_code node, GEN_OPTIONS
+ node2 = uglify.parser.parse src2
+
+ process.stdout.write uglify.uglify.gen_code node2, GEN_OPTIONS
process.stdout.write '\n'
process.stdout.write generatedFunctionsLine + '\n'