JS: refactor TemporaryVariableElimination
This commit is contained in:
+7
-1
@@ -5,18 +5,20 @@ function init() {
|
||||
log = "";
|
||||
}
|
||||
|
||||
function foo(n) {
|
||||
function foo_(n) {
|
||||
log += "{" + n + "}";
|
||||
return n;
|
||||
}
|
||||
|
||||
function test1() {
|
||||
var foo = foo_;
|
||||
init();
|
||||
|
||||
return foo(foo(1) + foo(2));
|
||||
}
|
||||
|
||||
function test2() {
|
||||
var foo = foo_;
|
||||
init();
|
||||
|
||||
var $tmp2 = foo(2);
|
||||
@@ -25,12 +27,14 @@ function test2() {
|
||||
}
|
||||
|
||||
function test3() {
|
||||
var foo = foo_;
|
||||
init();
|
||||
|
||||
return foo(foo(1) + foo(2) + foo(foo(3)));
|
||||
}
|
||||
|
||||
function test4() {
|
||||
var foo = foo_;
|
||||
init();
|
||||
|
||||
var $tmp1 = foo(1);
|
||||
@@ -41,6 +45,7 @@ function test4() {
|
||||
}
|
||||
|
||||
function test5() {
|
||||
var foo = foo_;
|
||||
init();
|
||||
|
||||
var $tmp1 = foo(1);
|
||||
@@ -52,6 +57,7 @@ function test5() {
|
||||
}
|
||||
|
||||
function test6() {
|
||||
var foo = foo_;
|
||||
init();
|
||||
|
||||
var $tmp = foo(1);
|
||||
|
||||
Reference in New Issue
Block a user