Skip to content

Instantly share code, notes, and snippets.

@vird
Created November 26, 2013 05:45
Show Gist options
  • Save vird/7653962 to your computer and use it in GitHub Desktop.
Save vird/7653962 to your computer and use it in GitHub Desktop.
iced code
opt=
block_start : 0
block_end : 10
console.log "start"
for i in [opt.block_start .. opt.block_end]
console.log i
await setTimeout (defer next), 0
console.log "end"
// Generated by IcedCoffeeScript 1.6.3-g
(function() {
var i, iced, next, opt, __iced_deferrals, __iced_k, __iced_k_noop,
_this = this;
iced = require('iced-coffee-script').iced;
__iced_k = __iced_k_noop = function() {};
opt = {
block_start: 0,
block_end: 10
};
console.log("start");
(function(__iced_k) {
var _i, _results, _while;
i = opt.block_start;
_results = [];
_while = function(__iced_k) {
var _break, _continue, _next;
_break = function() {
return __iced_k(_results);
};
_continue = function() {
return iced.trampoline(function() {
--i;
return _while(__iced_k);
});
};
_next = function(__iced_next_arg) {
_results.push(__iced_next_arg);
return _continue();
};
if (!(i >= opt.block_end)) {
return _break();
} else {
console.log(i);
(function(__iced_k) {
__iced_deferrals = new iced.Deferrals(__iced_k, {
filename: "simple.coffee"
});
setTimeout((__iced_deferrals.defer({
assign_fn: (function() {
return function() {
return next = arguments[0];
};
})(),
lineno: 6
})), 0);
__iced_deferrals._fulfill();
})(_next);
}
};
_while(__iced_k);
})(function() {
return console.log("end");
});
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment