mirror of https://gitee.com/bigwinds/arangodb
305 lines
8.7 KiB
JavaScript
305 lines
8.7 KiB
JavaScript
// Generated by IcedCoffeeScript 1.7.1-a
|
|
(function() {
|
|
var Pipeliner, iced, iced_internals, __iced_k, __iced_k_noop, _iand, _ior, _timeout,
|
|
__slice = [].slice;
|
|
|
|
__iced_k = __iced_k_noop = function() {};
|
|
|
|
iced_internals = require('./iced');
|
|
|
|
exports.iced = iced = iced_internals.runtime;
|
|
|
|
_timeout = function(cb, t, res, tmp) {
|
|
var arr, rv, which, ___iced_passed_deferral, __iced_deferrals, __iced_k;
|
|
__iced_k = __iced_k_noop;
|
|
___iced_passed_deferral = iced.findDeferral(arguments);
|
|
rv = new iced.Rendezvous;
|
|
tmp[0] = rv.id(true).defer({
|
|
assign_fn: (function(_this) {
|
|
return function() {
|
|
return function() {
|
|
return arr = __slice.call(arguments, 0);
|
|
};
|
|
};
|
|
})(this)(),
|
|
lineno: 17,
|
|
context: __iced_deferrals
|
|
});
|
|
setTimeout(rv.id(false).defer({
|
|
lineno: 18,
|
|
context: __iced_deferrals
|
|
}), t);
|
|
(function(_this) {
|
|
return (function(__iced_k) {
|
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
parent: ___iced_passed_deferral,
|
|
filename: "/Users/max/src/coffee-script/src/icedlib.coffee"
|
|
});
|
|
rv.wait(__iced_deferrals.defer({
|
|
assign_fn: (function() {
|
|
return function() {
|
|
return which = arguments[0];
|
|
};
|
|
})(),
|
|
lineno: 19
|
|
}));
|
|
__iced_deferrals._fulfill();
|
|
});
|
|
})(this)((function(_this) {
|
|
return function() {
|
|
if (res) {
|
|
res[0] = which;
|
|
}
|
|
return cb.apply(null, arr);
|
|
};
|
|
})(this));
|
|
};
|
|
|
|
exports.timeout = function(cb, t, res) {
|
|
var tmp;
|
|
tmp = [];
|
|
_timeout(cb, t, res, tmp);
|
|
return tmp[0];
|
|
};
|
|
|
|
_iand = function(cb, res, tmp) {
|
|
var ok, ___iced_passed_deferral, __iced_deferrals, __iced_k;
|
|
__iced_k = __iced_k_noop;
|
|
___iced_passed_deferral = iced.findDeferral(arguments);
|
|
(function(_this) {
|
|
return (function(__iced_k) {
|
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
parent: ___iced_passed_deferral,
|
|
filename: "/Users/max/src/coffee-script/src/icedlib.coffee"
|
|
});
|
|
tmp[0] = __iced_deferrals.defer({
|
|
assign_fn: (function() {
|
|
return function() {
|
|
return ok = arguments[0];
|
|
};
|
|
})(),
|
|
lineno: 34
|
|
});
|
|
__iced_deferrals._fulfill();
|
|
});
|
|
})(this)((function(_this) {
|
|
return function() {
|
|
if (!ok) {
|
|
res[0] = false;
|
|
}
|
|
return cb();
|
|
};
|
|
})(this));
|
|
};
|
|
|
|
exports.iand = function(cb, res) {
|
|
var tmp;
|
|
tmp = [];
|
|
_iand(cb, res, tmp);
|
|
return tmp[0];
|
|
};
|
|
|
|
_ior = function(cb, res, tmp) {
|
|
var ok, ___iced_passed_deferral, __iced_deferrals, __iced_k;
|
|
__iced_k = __iced_k_noop;
|
|
___iced_passed_deferral = iced.findDeferral(arguments);
|
|
(function(_this) {
|
|
return (function(__iced_k) {
|
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
parent: ___iced_passed_deferral,
|
|
filename: "/Users/max/src/coffee-script/src/icedlib.coffee"
|
|
});
|
|
tmp[0] = __iced_deferrals.defer({
|
|
assign_fn: (function() {
|
|
return function() {
|
|
return ok = arguments[0];
|
|
};
|
|
})(),
|
|
lineno: 51
|
|
});
|
|
__iced_deferrals._fulfill();
|
|
});
|
|
})(this)((function(_this) {
|
|
return function() {
|
|
if (ok) {
|
|
res[0] = true;
|
|
}
|
|
return cb();
|
|
};
|
|
})(this));
|
|
};
|
|
|
|
exports.ior = function(cb, res) {
|
|
var tmp;
|
|
tmp = [];
|
|
_ior(cb, res, tmp);
|
|
return tmp[0];
|
|
};
|
|
|
|
exports.Pipeliner = Pipeliner = (function() {
|
|
function Pipeliner(window, delay) {
|
|
this.window = window || 1;
|
|
this.delay = delay || 0;
|
|
this.queue = [];
|
|
this.n_out = 0;
|
|
this.cb = null;
|
|
this[iced_internals["const"].deferrals] = this;
|
|
this["defer"] = this._defer;
|
|
}
|
|
|
|
Pipeliner.prototype.waitInQueue = function(cb) {
|
|
var ___iced_passed_deferral, __iced_deferrals, __iced_k;
|
|
__iced_k = __iced_k_noop;
|
|
___iced_passed_deferral = iced.findDeferral(arguments);
|
|
(function(_this) {
|
|
return (function(__iced_k) {
|
|
var _results, _while;
|
|
_results = [];
|
|
_while = function(__iced_k) {
|
|
var _break, _continue, _next;
|
|
_break = function() {
|
|
return __iced_k(_results);
|
|
};
|
|
_continue = function() {
|
|
return iced.trampoline(function() {
|
|
return _while(__iced_k);
|
|
});
|
|
};
|
|
_next = function(__iced_next_arg) {
|
|
_results.push(__iced_next_arg);
|
|
return _continue();
|
|
};
|
|
if (!(_this.n_out >= _this.window)) {
|
|
return _break();
|
|
} else {
|
|
(function(__iced_k) {
|
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
parent: ___iced_passed_deferral,
|
|
filename: "/Users/max/src/coffee-script/src/icedlib.coffee",
|
|
funcname: "Pipeliner.waitInQueue"
|
|
});
|
|
_this.cb = __iced_deferrals.defer({
|
|
lineno: 88
|
|
});
|
|
__iced_deferrals._fulfill();
|
|
})(_next);
|
|
}
|
|
};
|
|
_while(__iced_k);
|
|
});
|
|
})(this)((function(_this) {
|
|
return function() {
|
|
_this.n_out++;
|
|
(function(__iced_k) {
|
|
if (_this.delay) {
|
|
(function(__iced_k) {
|
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
parent: ___iced_passed_deferral,
|
|
filename: "/Users/max/src/coffee-script/src/icedlib.coffee",
|
|
funcname: "Pipeliner.waitInQueue"
|
|
});
|
|
setTimeout(__iced_deferrals.defer({
|
|
lineno: 96
|
|
}), _this.delay);
|
|
__iced_deferrals._fulfill();
|
|
})(__iced_k);
|
|
} else {
|
|
return __iced_k();
|
|
}
|
|
})(function() {
|
|
return cb();
|
|
});
|
|
};
|
|
})(this));
|
|
};
|
|
|
|
Pipeliner.prototype.__defer = function(out, deferArgs) {
|
|
var tmp, voidCb, ___iced_passed_deferral, __iced_deferrals, __iced_k;
|
|
__iced_k = __iced_k_noop;
|
|
___iced_passed_deferral = iced.findDeferral(arguments);
|
|
(function(_this) {
|
|
return (function(__iced_k) {
|
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
parent: ___iced_passed_deferral,
|
|
filename: "/Users/max/src/coffee-script/src/icedlib.coffee",
|
|
funcname: "Pipeliner.__defer"
|
|
});
|
|
voidCb = __iced_deferrals.defer({
|
|
lineno: 109
|
|
});
|
|
out[0] = function() {
|
|
var args, _ref;
|
|
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
|
if ((_ref = deferArgs.assign_fn) != null) {
|
|
_ref.apply(null, args);
|
|
}
|
|
return voidCb();
|
|
};
|
|
__iced_deferrals._fulfill();
|
|
});
|
|
})(this)((function(_this) {
|
|
return function() {
|
|
_this.n_out--;
|
|
if (_this.cb) {
|
|
tmp = _this.cb;
|
|
_this.cb = null;
|
|
return tmp();
|
|
}
|
|
};
|
|
})(this));
|
|
};
|
|
|
|
Pipeliner.prototype._defer = function(deferArgs) {
|
|
var tmp;
|
|
tmp = [];
|
|
this.__defer(tmp, deferArgs);
|
|
return tmp[0];
|
|
};
|
|
|
|
Pipeliner.prototype.flush = function(autocb) {
|
|
var ___iced_passed_deferral, __iced_k, _results, _while;
|
|
__iced_k = autocb;
|
|
___iced_passed_deferral = iced.findDeferral(arguments);
|
|
_results = [];
|
|
_while = (function(_this) {
|
|
var __iced_deferrals;
|
|
return function(__iced_k) {
|
|
var _break, _continue, _next;
|
|
_break = function() {
|
|
return __iced_k(_results);
|
|
};
|
|
_continue = function() {
|
|
return iced.trampoline(function() {
|
|
return _while(__iced_k);
|
|
});
|
|
};
|
|
_next = function(__iced_next_arg) {
|
|
_results.push(__iced_next_arg);
|
|
return _continue();
|
|
};
|
|
if (!_this.n_out) {
|
|
return _break();
|
|
} else {
|
|
(function(__iced_k) {
|
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
parent: ___iced_passed_deferral,
|
|
filename: "/Users/max/src/coffee-script/src/icedlib.coffee",
|
|
funcname: "Pipeliner.flush"
|
|
});
|
|
_this.cb = __iced_deferrals.defer({
|
|
lineno: 136
|
|
});
|
|
__iced_deferrals._fulfill();
|
|
})(_next);
|
|
}
|
|
};
|
|
})(this);
|
|
_while(__iced_k);
|
|
};
|
|
|
|
return Pipeliner;
|
|
|
|
})();
|
|
|
|
}).call(this);
|