Created
June 8, 2014 05:55
-
-
Save gfx/3bee4b43b62d64a1f799 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// generatedy by JSX compiler 0.9.89 (2014-05-20 06:01:03 +0900; 8e8c6105f36f3dfe440ea026a3c93a3444977102) | |
var JSX = {}; | |
(function (JSX) { | |
/** | |
* extends the class | |
*/ | |
function $__jsx_extend(derivations, base) { | |
var ctor = function () {}; | |
ctor.prototype = base.prototype; | |
var proto = new ctor(); | |
for (var i in derivations) { | |
derivations[i].prototype = proto; | |
} | |
} | |
/** | |
* copies the implementations from source interface to target | |
*/ | |
function $__jsx_merge_interface(target, source) { | |
for (var k in source.prototype) | |
if (source.prototype.hasOwnProperty(k)) | |
target.prototype[k] = source.prototype[k]; | |
} | |
/** | |
* defers the initialization of the property | |
*/ | |
function $__jsx_lazy_init(obj, prop, func) { | |
function reset(obj, prop, value) { | |
delete obj[prop]; | |
obj[prop] = value; | |
return value; | |
} | |
Object.defineProperty(obj, prop, { | |
get: function () { | |
return reset(obj, prop, func()); | |
}, | |
set: function (v) { | |
reset(obj, prop, v); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
} | |
var $__jsx_imul = Math.imul; | |
if (typeof $__jsx_imul === "undefined") { | |
$__jsx_imul = function (a, b) { | |
var ah = (a >>> 16) & 0xffff; | |
var al = a & 0xffff; | |
var bh = (b >>> 16) & 0xffff; | |
var bl = b & 0xffff; | |
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0); | |
}; | |
} | |
/** | |
* fused int-ops with side-effects | |
*/ | |
function $__jsx_ipadd(o, p, r) { | |
return o[p] = (o[p] + r) | 0; | |
} | |
function $__jsx_ipsub(o, p, r) { | |
return o[p] = (o[p] - r) | 0; | |
} | |
function $__jsx_ipmul(o, p, r) { | |
return o[p] = $__jsx_imul(o[p], r); | |
} | |
function $__jsx_ipdiv(o, p, r) { | |
return o[p] = (o[p] / r) | 0; | |
} | |
function $__jsx_ipmod(o, p, r) { | |
return o[p] = (o[p] % r) | 0; | |
} | |
function $__jsx_ippostinc(o, p) { | |
var v = o[p]; | |
o[p] = (v + 1) | 0; | |
return v; | |
} | |
function $__jsx_ippostdec(o, p) { | |
var v = o[p]; | |
o[p] = (v - 1) | 0; | |
return v; | |
} | |
/** | |
* non-inlined version of Array#each | |
*/ | |
function $__jsx_forEach(o, f) { | |
var l = o.length; | |
for (var i = 0; i < l; ++i) | |
f(o[i]); | |
} | |
/* | |
* global functions, renamed to avoid conflict with local variable names | |
*/ | |
var $__jsx_parseInt = parseInt; | |
var $__jsx_parseFloat = parseFloat; | |
function $__jsx_isNaN(n) { return n !== n; } | |
var $__jsx_isFinite = isFinite; | |
var $__jsx_encodeURIComponent = encodeURIComponent; | |
var $__jsx_decodeURIComponent = decodeURIComponent; | |
var $__jsx_encodeURI = encodeURI; | |
var $__jsx_decodeURI = decodeURI; | |
var $__jsx_ObjectToString = Object.prototype.toString; | |
var $__jsx_ObjectHasOwnProperty = Object.prototype.hasOwnProperty; | |
/* | |
* profiler object, initialized afterwards | |
*/ | |
function $__jsx_profiler() { | |
} | |
/* | |
* public interface to JSX code | |
*/ | |
JSX.require = function (path) { | |
var m = $__jsx_classMap[path]; | |
return m !== undefined ? m : null; | |
}; | |
JSX.profilerIsRunning = function () { | |
return $__jsx_profiler.getResults != null; | |
}; | |
JSX.getProfileResults = function () { | |
return ($__jsx_profiler.getResults || function () { return {}; })(); | |
}; | |
JSX.postProfileResults = function (url, cb) { | |
if ($__jsx_profiler.postResults == null) | |
throw new Error("profiler has not been turned on"); | |
return $__jsx_profiler.postResults(url, cb); | |
}; | |
JSX.resetProfileResults = function () { | |
if ($__jsx_profiler.resetResults == null) | |
throw new Error("profiler has not been turned on"); | |
return $__jsx_profiler.resetResults(); | |
}; | |
JSX.DEBUG = true; | |
var GeneratorFunction$0 = | |
(function () { | |
try { | |
return Function('import {GeneratorFunction} from "std:iteration"; return GeneratorFunction')(); | |
} catch (e) { | |
return function GeneratorFunction () {}; | |
} | |
})(); | |
var __jsx_generator_object$0 = | |
(function () { | |
function __jsx_generator_object() { | |
this.__next = 0; | |
this.__loop = null; | |
this.__seed = null; | |
this.__value = undefined; | |
this.__status = 0; // SUSPENDED: 0, ACTIVE: 1, DEAD: 2 | |
} | |
__jsx_generator_object.prototype.next = function (seed) { | |
switch (this.__status) { | |
case 0: | |
this.__status = 1; | |
this.__seed = seed; | |
// go next! | |
this.__loop(this.__next); | |
var done = false; | |
if (this.__next != -1) { | |
this.__status = 0; | |
} else { | |
this.__status = 2; | |
done = true; | |
} | |
return { value: this.__value, done: done }; | |
case 1: | |
throw new Error("Generator is already running"); | |
case 2: | |
throw new Error("Generator is already finished"); | |
default: | |
throw new Error("Unexpected generator internal state"); | |
} | |
}; | |
return __jsx_generator_object; | |
}()); | |
function _Main() { | |
}; | |
$__jsx_extend([_Main], Object); | |
function _Main$main$AS(args) { | |
var fib; | |
var g; | |
var i; | |
function fib() { | |
var a; | |
var b; | |
var tmp; | |
var $generator; | |
var $loop; | |
var $localJumps; | |
var $return; | |
var $raised; | |
var $error; | |
$generator = new __jsx_generator_object$0(); | |
$localJumps = [ ]; | |
function $loop($next) { | |
var $a3; | |
var $a1; | |
var $a4; | |
var $a2; | |
var $a0; | |
var $a5; | |
var $a7; | |
var $a6; | |
var $a9; | |
var $a8; | |
var $a11; | |
var $a10; | |
var $a14; | |
var $a15; | |
var $a13; | |
var $a12; | |
while (true) { | |
try { | |
while (true) { | |
switch ($next) { | |
case 0: | |
$a3 = 0; | |
$a1 = a = $a3; | |
$a4 = 1; | |
$a2 = b = $a4; | |
$a0 = ($a1, $a2); | |
$a0; | |
$next = 1; | |
break; | |
case 1: | |
$a5 = true; | |
if ($a5) { | |
$next = 2; | |
break; | |
} else { | |
$next = 3; | |
break; | |
} | |
case 2: | |
$a7 = a; | |
$generator.__value = $a7; | |
$generator.__next = 4; | |
return; | |
case 4: | |
$a6 = $generator.__seed; | |
$a6; | |
$a9 = a; | |
$a8 = tmp = $a9; | |
$a8; | |
$a11 = b; | |
$a10 = a = $a11; | |
$a10; | |
$a14 = tmp; | |
$a15 = b; | |
$a13 = $a14 + $a15; | |
$a12 = b = $a13; | |
$a12; | |
$next = 1; | |
break; | |
case 3: | |
$generator.__value = $return; | |
$generator.__next = -1; | |
return; | |
} | |
} | |
} catch ($__jsx_catch_0) { | |
{ | |
$raised = true; | |
$error = $__jsx_catch_0; | |
$next = $localJumps[$localJumps.length - 1]; | |
} | |
} finally { | |
if ($localJumps.length === 0 && $raised) { | |
throw $error; | |
} | |
} | |
} | |
} | |
$generator.__next = 0; | |
$generator.__loop = $loop; | |
return $generator; | |
} | |
g = fib(); | |
for (i = 0; i < 10; i++) { | |
console.log(g.next().value); | |
} | |
}; | |
_Main.main = _Main$main$AS; | |
_Main.main$AS = _Main$main$AS; | |
var $__jsx_classMap = { | |
"example/yield-prime.jsx": { | |
_Main: _Main, | |
_Main$: _Main | |
} | |
}; | |
})(JSX); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment