Skip to content
Browse files

upgraded spoon - 25 eval tests pass now

  • Loading branch information...
1 parent abf6982 commit 354816b0311621a39f0535c20d6c1028f1e21687 @bjouhier bjouhier committed
Showing with 1,339 additions and 232 deletions.
  1. +235 −28 lib/spoon/builtins.js
  2. +11 −12 test/common/spoon/eval-test._js
  3. +1,093 −192 test/common/spoon/eval-test.js
View
263 lib/spoon/builtins.js
@@ -172,13 +172,19 @@ var __$i0 = function(exports) {
configurable: true,
writable: true,
enumerable: false,
- value: function(__$callback, options, fn, thisObj) {
+ value: function __$anon1(__$callback, options, fn, thisObj) {
+ if (!__$callback) {
+ return __$rt.future.call(this, __$anon1, arguments, 0);
+ }
var __$i412;
var __$i403;
var __$i393;
+ var __$r386;
function __$fn386(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r386 = __$r
};
while (true) {
if (!(i < len)) {
@@ -190,28 +196,40 @@ var __$i0 = function(exports) {
};
return __$fn383.call(this);
};
+ var __$r385;
function __$fn385(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r385 = __$r
};
i++;
return __$fn386.call(this);
};
+ var __$r384;
function __$fn384(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r384 = __$r
};
return __$fn385.call(this);
};
+ var __$r383;
function __$fn383(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r383 = __$r
};
return __$callback.call(this, null, this);
};
+ var __$r382;
function __$fn382(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r382 = __$r
};
return __$fn383.call(this);
};
@@ -251,13 +269,19 @@ var __$i0 = function(exports) {
configurable: true,
writable: true,
enumerable: false,
- value: function(__$callback, options, fn, thisObj) {
+ value: function __$anon2(__$callback, options, fn, thisObj) {
+ if (!__$callback) {
+ return __$rt.future.call(this, __$anon2, arguments, 0);
+ }
var __$i508;
var __$i499;
var __$i488;
+ var __$r393;
function __$fn393(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r393 = __$r
};
while (true) {
if (!(i < len)) {
@@ -269,29 +293,41 @@ var __$i0 = function(exports) {
};
return __$fn390.call(this);
};
+ var __$r392;
function __$fn392(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r392 = __$r
};
i++;
return __$fn393.call(this);
};
+ var __$r391;
function __$fn391(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r391 = __$r
};
- __$i581[__$i582] = __$r;
+ __$i581[__$i582] = __$r391;
return __$fn392.call(this);
};
+ var __$r390;
function __$fn390(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r390 = __$r
};
return __$callback.call(this, null, result);
};
+ var __$r389;
function __$fn389(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r389 = __$r
};
while (true) {
if (!(i < len)) {
@@ -303,18 +339,24 @@ var __$i0 = function(exports) {
};
return __$fn390.call(this);
};
+ var __$r388;
function __$fn388(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r388 = __$r
};
i++;
return __$fn389.call(this);
};
+ var __$r387;
function __$fn387(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r387 = __$r
};
- __$i533[__$i534] = __$r;
+ __$i533[__$i534] = __$r387;
return __$fn388.call(this);
};
var i;
@@ -349,12 +391,18 @@ var __$i0 = function(exports) {
} else {
fun = funnel(par);
result = this.map(function(elt, i) {
- return fun(null, function(__$callback) {
+ return fun(null, function __$anon3(__$callback) {
+ if (!__$callback) {
+ return __$rt.future.call(this, __$anon3, arguments, 0);
+ }
+ var __$r435;
function __$fn435(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r435 = __$r
};
- return __$callback.call(this, null, __$r);
+ return __$callback.call(this, null, __$r435);
};
return fn.call(thisObj, __$fn435, elt, i);
});
@@ -369,13 +417,19 @@ var __$i0 = function(exports) {
configurable: true,
writable: true,
enumerable: false,
- value: function(__$callback, options, fn, thisObj) {
+ value: function __$anon4(__$callback, options, fn, thisObj) {
+ if (!__$callback) {
+ return __$rt.future.call(this, __$anon4, arguments, 0);
+ }
var __$i648;
var __$i639;
var __$i626;
+ var __$r398;
function __$fn398(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r398 = __$r
};
while (true) {
if (!(i < len)) {
@@ -387,31 +441,43 @@ var __$i0 = function(exports) {
};
return __$fn395.call(this);
};
+ var __$r397;
function __$fn397(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r397 = __$r
};
i++;
return __$fn398.call(this);
};
+ var __$r396;
function __$fn396(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r396 = __$r
};
- if (__$r) {
+ if (__$r396) {
result.push(elt);
} else {};
return __$fn397.call(this);
};
+ var __$r395;
function __$fn395(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r395 = __$r
};
return __$callback.call(this, null, result);
};
+ var __$r394;
function __$fn394(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r394 = __$r
};
return __$fn395.call(this);
};
@@ -444,12 +510,18 @@ var __$i0 = function(exports) {
i = 0;
return __$fn398.call(this);
} else {
- return this.map_(__$fn394, par, function(__$callback, elt) {
+ return this.map_(__$fn394, par, function __$anon5(__$callback, elt) {
+ if (!__$callback) {
+ return __$rt.future.call(this, __$anon5, arguments, 0);
+ }
+ var __$r420;
function __$fn420(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r420 = __$r
};
- if (__$r) {
+ if (__$r420) {
result.push(elt);
} else {};
return __$callback.call(this, null);
@@ -464,7 +536,10 @@ var __$i0 = function(exports) {
configurable: true,
writable: true,
enumerable: false,
- value: function(__$callback, options, fn, thisObj) {
+ value: function __$anon6(__$callback, options, fn, thisObj) {
+ if (!__$callback) {
+ return __$rt.future.call(this, __$anon6, arguments, 0);
+ }
var __$i824;
var __$i835;
var __$i770;
@@ -472,9 +547,12 @@ var __$i0 = function(exports) {
var __$i751;
var __$i742;
var __$i732;
+ var __$r405;
function __$fn405(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r405 = __$r
};
while (true) {
if (!(i < len)) {
@@ -491,9 +569,12 @@ var __$i0 = function(exports) {
};
return __$fn402.call(this);
};
+ var __$r404;
function __$fn404(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r404 = __$r
};
if (__$i835) {
fun.close();
@@ -503,22 +584,31 @@ var __$i0 = function(exports) {
return __$fn405.call(this);
};
};
+ var __$r403;
function __$fn403(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r403 = __$r
};
- __$i835 = !__$r;
+ __$i835 = !__$r403;
return __$fn404.call(this);
};
+ var __$r402;
function __$fn402(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r402 = __$r
};
return __$callback.call(this, null, true);
};
+ var __$r401;
function __$fn401(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r401 = __$r
};
while (true) {
if (!(i < len)) {
@@ -535,9 +625,12 @@ var __$i0 = function(exports) {
};
return __$fn402.call(this);
};
+ var __$r400;
function __$fn400(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r400 = __$r
};
if (__$i785) {
return __$callback.call(this, null, false);
@@ -546,11 +639,14 @@ var __$i0 = function(exports) {
return __$fn401.call(this);
};
};
+ var __$r399;
function __$fn399(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r399 = __$r
};
- __$i785 = !__$r;
+ __$i785 = !__$r399;
return __$fn400.call(this);
};
var i;
@@ -584,12 +680,18 @@ var __$i0 = function(exports) {
} else {
fun = funnel(par);
futures = this.map(function(elt) {
- return fun(null, function(__$callback) {
+ return fun(null, function __$anon7(__$callback) {
+ if (!__$callback) {
+ return __$rt.future.call(this, __$anon7, arguments, 0);
+ }
+ var __$r436;
function __$fn436(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r436 = __$r
};
- return __$callback.call(this, null, __$r);
+ return __$callback.call(this, null, __$r436);
};
return fn.call(thisObj, __$fn436, elt);
});
@@ -604,7 +706,10 @@ var __$i0 = function(exports) {
configurable: true,
writable: true,
enumerable: false,
- value: function(__$callback, options, fn, thisObj) {
+ value: function __$anon8(__$callback, options, fn, thisObj) {
+ if (!__$callback) {
+ return __$rt.future.call(this, __$anon8, arguments, 0);
+ }
var __$i971;
var __$i981;
var __$i918;
@@ -612,9 +717,12 @@ var __$i0 = function(exports) {
var __$i899;
var __$i890;
var __$i880;
+ var __$r412;
function __$fn412(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r412 = __$r
};
while (true) {
if (!(i < len)) {
@@ -631,9 +739,12 @@ var __$i0 = function(exports) {
};
return __$fn409.call(this);
};
+ var __$r411;
function __$fn411(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r411 = __$r
};
if (__$i981) {
fun.close();
@@ -643,22 +754,31 @@ var __$i0 = function(exports) {
return __$fn412.call(this);
};
};
+ var __$r410;
function __$fn410(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r410 = __$r
};
- __$i981 = __$r;
+ __$i981 = __$r410;
return __$fn411.call(this);
};
+ var __$r409;
function __$fn409(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r409 = __$r
};
return __$callback.call(this, null, false);
};
+ var __$r408;
function __$fn408(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r408 = __$r
};
while (true) {
if (!(i < len)) {
@@ -675,9 +795,12 @@ var __$i0 = function(exports) {
};
return __$fn409.call(this);
};
+ var __$r407;
function __$fn407(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r407 = __$r
};
if (__$i932) {
return __$callback.call(this, null, true);
@@ -686,11 +809,14 @@ var __$i0 = function(exports) {
return __$fn408.call(this);
};
};
+ var __$r406;
function __$fn406(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r406 = __$r
};
- __$i932 = __$r;
+ __$i932 = __$r406;
return __$fn407.call(this);
};
var i;
@@ -724,12 +850,18 @@ var __$i0 = function(exports) {
} else {
fun = funnel(par);
futures = this.map(function(elt) {
- return fun(null, function(__$callback) {
+ return fun(null, function __$anon9(__$callback) {
+ if (!__$callback) {
+ return __$rt.future.call(this, __$anon9, arguments, 0);
+ }
+ var __$r437;
function __$fn437(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r437 = __$r
};
- return __$callback.call(this, null, __$r);
+ return __$callback.call(this, null, __$r437);
};
return fn.call(thisObj, __$fn437, elt);
});
@@ -744,11 +876,17 @@ var __$i0 = function(exports) {
configurable: true,
writable: true,
enumerable: false,
- value: function(__$callback, fn, v, thisObj) {
+ value: function __$anon10(__$callback, fn, v, thisObj) {
+ if (!__$callback) {
+ return __$rt.future.call(this, __$anon10, arguments, 0);
+ }
var __$i1009;
+ var __$r415;
function __$fn415(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r415 = __$r
};
while (true) {
if (!(i < len)) {
@@ -760,18 +898,24 @@ var __$i0 = function(exports) {
};
return __$callback.call(this, null, v);
};
+ var __$r414;
function __$fn414(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r414 = __$r
};
i++;
return __$fn415.call(this);
};
+ var __$r413;
function __$fn413(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r413 = __$r
};
- v = __$r;
+ v = __$r413;
return __$fn414.call(this);
};
var i;
@@ -792,11 +936,17 @@ var __$i0 = function(exports) {
configurable: true,
writable: true,
enumerable: false,
- value: function(__$callback, fn, v, thisObj) {
+ value: function __$anon11(__$callback, fn, v, thisObj) {
+ if (!__$callback) {
+ return __$rt.future.call(this, __$anon11, arguments, 0);
+ }
var __$i1066;
+ var __$r418;
function __$fn418(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r418 = __$r
};
while (true) {
if (!(i >= 0)) {
@@ -808,18 +958,24 @@ var __$i0 = function(exports) {
};
return __$callback.call(this, null, v);
};
+ var __$r417;
function __$fn417(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r417 = __$r
};
i--;
return __$fn418.call(this);
};
+ var __$r416;
function __$fn416(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r416 = __$r
};
- v = __$r;
+ v = __$r416;
return __$fn417.call(this);
};
var i;
@@ -840,13 +996,19 @@ var __$i0 = function(exports) {
configurable: true,
writable: true,
enumerable: false,
- value: function(__$callback, compare, beg, end) {
+ value: function __$anon12(__$callback, compare, beg, end) {
+ if (!__$callback) {
+ return __$rt.future.call(this, __$anon12, arguments, 0);
+ }
var __$i1142;
var __$i1125;
var __$i1118;
+ var __$r419;
function __$fn419(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r419 = __$r
};
return __$callback.call(this, null, array);
};
@@ -866,14 +1028,21 @@ var __$i0 = function(exports) {
};
end = __$i1142;
function _qsort(__$callback, beg, end) {
+ if (!__$callback) {
+ return __$rt.future.call(this, _qsort, arguments, 0);
+ }
var __$i1440;
var __$i1455;
var __$i1409;
var __$i1424;
+ var __$r426;
function __$fn426(__$e, __$r) {
+ var __$r430;
function __$fn430(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r430 = __$r
};
if (nbeg <= nend) {
tmp = array[nbeg];
@@ -884,9 +1053,12 @@ var __$i0 = function(exports) {
} else {};
return __$fn425.call(this);
};
+ var __$r429;
function __$fn429(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r429 = __$r
};
while (true) {
__$i1440 = beg < nend;
@@ -899,9 +1071,12 @@ var __$i0 = function(exports) {
};
return __$fn430.call(this);
};
+ var __$r428;
function __$fn428(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r428 = __$r
};
if (!__$i1455) {
return __$fn430.call(this);
@@ -910,46 +1085,66 @@ var __$i0 = function(exports) {
return __$fn429.call(this);
};
};
+ var __$r427;
function __$fn427(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r427 = __$r
};
- __$i1455 = __$r < 0;
+ __$i1455 = __$r427 < 0;
return __$fn428.call(this);
};
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r426 = __$r
};
return __$fn429.call(this);
};
+ var __$r425;
function __$fn425(__$e, __$r) {
+ var __$r432;
function __$fn432(__$e, __$r) {
+ var __$r434;
function __$fn434(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r434 = __$r
};
return __$callback.call(this, null);
};
+ var __$r433;
function __$fn433(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r433 = __$r
};
return __$fn434.call(this);
};
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r432 = __$r
};
beg < nend;
return __$fn434.call(this);
};
+ var __$r431;
function __$fn431(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r431 = __$r
};
return __$fn432.call(this);
};
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r425 = __$r
};
while (true) {
if (!(nbeg <= nend)) {
@@ -961,9 +1156,12 @@ var __$i0 = function(exports) {
nbeg < end;
return __$fn432.call(this);
};
+ var __$r424;
function __$fn424(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r424 = __$r
};
while (true) {
__$i1409 = nbeg < end;
@@ -976,9 +1174,12 @@ var __$i0 = function(exports) {
};
return __$fn426.call(this);
};
+ var __$r423;
function __$fn423(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r423 = __$r
};
if (!__$i1424) {
return __$fn426.call(this);
@@ -987,18 +1188,24 @@ var __$i0 = function(exports) {
return __$fn424.call(this);
};
};
+ var __$r422;
function __$fn422(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r422 = __$r
};
- __$i1424 = __$r < 0;
+ __$i1424 = __$r422 < 0;
return __$fn423.call(this);
};
+ var __$r421;
function __$fn421(__$e, __$r) {
if (__$e) {
return __$callback.call(this, __$e);
+ } else {
+ __$r421 = __$r
};
- if (__$r > 0) {
+ if (__$r421 > 0) {
tmp = array[beg];
array[beg] = array[end];
array[end] = tmp;
View
23 test/common/spoon/eval-test._js
@@ -52,7 +52,6 @@ asyncTest("eval while", 1, function(_) {
return result;
}, 24);
})
-/* fails with undefined __$ixxx var
asyncTest("eval for", 1, function(_) {
evalTest(function f(_) {
var result = 1;
@@ -61,8 +60,7 @@ asyncTest("eval for", 1, function(_) {
}
return result;
}, 24);
-})*/
-/* fails with reference to __$fnxxxx defined in inner scope
+})
asyncTest("eval for in", 1, function(_) {
evalTest(function f(_) {
var foo = {
@@ -78,6 +76,7 @@ asyncTest("eval for in", 1, function(_) {
return result;
}, 30);
})
+
asyncTest("fully async for in", 1, function(_) {
evalTest(function f(_) {
var result = 1;
@@ -132,7 +131,7 @@ asyncTest("continue in while", 1, function(_) {
}, 24);
})
-asyncTest("for (;;)", 1, function(_) {
+/*asyncTest("for (;;)", 1, function(_) {
evalTest(function f(_) {
var i = 0;
for (;;) {
@@ -140,7 +139,7 @@ asyncTest("for (;;)", 1, function(_) {
}
}, 10);
})
-
+*/
asyncTest("eval lazy", 1, function(_) {
evalTest(function f(_) {
var result = 1;
@@ -153,7 +152,7 @@ asyncTest("eval lazy full async", 1, function(_) {
return delay(_, delay(_, result + 8) < 5) && true ? delay(_, 2) : delay(_, 4)
}, 4);
})
-*/
+
asyncTest("try catch 1", 1, function(_) {
evalTest(function f(_) {
try {
@@ -575,7 +574,7 @@ asyncTest("return undefined", 1, function(_) {
return test(_);
}, undefined);
})
-/*
+
asyncTest("futures test", 1, function(_) {
evalTest(function f(_) {
function delay2(val, _) {
@@ -589,7 +588,7 @@ asyncTest("futures test", 1, function(_) {
return a(_) + b(_) + d(_) + c(_);
}, "abdc");
})
-
+/*
asyncTest("last case without break", 1, function(_) {
evalTest(function f(_) {
switch (true) {
@@ -599,14 +598,14 @@ asyncTest("last case without break", 1, function(_) {
return 1;
}, 1);
})
-
+*/
asyncTest("async comma operator", 1, function(_) {
evalTest(function f(_) {
var a;
return a = 4, a++, a = delay(_, 2 * a), delay(_, a + 1);
}, 11);
})
-
+/*
// NEXT TEST FAILS BECAUSE OF STREAMLINE
asyncTest("async constructor", 1, function(_) {
evalTest(function f(_) {
@@ -620,7 +619,7 @@ asyncTest("async constructor", 1, function(_) {
return new Foo(5, _).y();
}, 6);
})
-
+*/
asyncTest("fibo false async", 1, function(_) {
evalTest(function f(_) {
function fibo(_, n) {
@@ -629,7 +628,7 @@ asyncTest("fibo false async", 1, function(_) {
return fibo(_, 16);
}, 1597);
})
-*/
+
asyncTest("coffeescript wrapper 1", 1, function(_) {
evalTest(function f(_) {
View
1,285 test/common/spoon/eval-test.js
1,093 additions, 192 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

0 comments on commit 354816b

Please sign in to comment.
Something went wrong with that request. Please try again.