Clean up transformations after #714.

Since now we have runtime helper, we don't need
expression -> statement conversions anymore.
This commit is contained in:
Ingvar Stepanyan
2015-02-08 10:15:25 +02:00
parent cde988f99f
commit 91362f80b1
7 changed files with 23 additions and 82 deletions

View File

@@ -5,9 +5,5 @@
console.log(this, arguments);
return "foo";
}
if (Math.random() > 0.5) {
return to5Runtime.tailCall(f.call, [this, n - 1], f);
} else {
return to5Runtime.tailCall(f.apply, [this, [n - 1]], f);
}
return Math.random() > 0.5 ? to5Runtime.tailCall(f.call, [this, n - 1], f) : to5Runtime.tailCall(f.apply, [this, [n - 1]], f);
})(1000000) === "foo";

View File

@@ -1,7 +1,7 @@
function f(n) {
return n <= 0 ? "foo" : g(n - 1);
return n <= 0 ? "foo" : g(n - 1);
}
function g(n) {
return n <= 0 ? "goo" : f(n - 1);
return n <= 0 ? "goo" : f(n - 1);
}

View File

@@ -1,17 +1,9 @@
"use strict";
function f(n) {
if (n <= 0) {
return "foo";
} else {
return to5Runtime.tailCall(g, [n - 1]);
}
return n <= 0 ? "foo" : to5Runtime.tailCall(g, [n - 1]);
}
function g(n) {
if (n <= 0) {
return "goo";
} else {
return to5Runtime.tailCall(f, [n - 1]);
}
return n <= 0 ? "goo" : to5Runtime.tailCall(f, [n - 1]);
}

View File

@@ -1,18 +1,5 @@
"use strict";
(function f(n) {
var _temp;
if (n <= 0) {
return "foo";
} else {
doSmth();
if (!(_temp = getTrueValue())) {
return _temp;
}
if (_temp = getFalseValue()) {
return _temp;
}
return to5Runtime.tailCall(f, [n - 1]);
}
return n <= 0 ? "foo" : (doSmth(), getTrueValue() && (getFalseValue() || to5Runtime.tailCall(f, [n - 1])));
})(1000000, true) === "foo";

View File

@@ -1,5 +1,5 @@
function f() {
return getObj().method();
return getObj().method();
}
function g() {

View File

@@ -6,9 +6,5 @@ function f() {
}
function g() {
var _temp;
if (_temp = getFalseValue()) {
return _temp;
}
return to5Runtime.tailCall(getValue);
return getFalseValue() || to5Runtime.tailCall(getValue);
}