Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var fiber = Fiber(function(){
Sync.stat.activeFibers++;
var fiber = Fiber.current,
result,
error;
// Set id to fiber
fiber.id = Sync.stat.totalFibers;
// Save the callback to fiber
fiber.callback = callback;
// Register trace error to the fiber
fiber.traceError = traceError;
// Initialize scope
fiber.scope = {};
// Assign parent fiber
promise = promise.then(function (count) {
assert.ok(Fiber.current instanceof Fiber);
assert.notStrictEqual(Fiber.current, originalFiber);
return count + 1;
});
}
function syncFunctionTimeout(t) {
var fiber = Fiber.current;
setTimeout(function(){
fiber.run('result');
}, t)
return Fiber.yield();
}
stylesheet_link_tag = function(filename, options) {
var opt_str = "";
if (typeof options !== "undefined") {
for (var k in options) {
opt_str = opt_str + " " + k + "=" + options[k];
}
}
if (filename == "application") {
var filepath = ROOT_APP + '/app/assets/stylesheets/application.css';
var input = fs.createReadStream(filepath);
var remaining = '';
var html = "";
var fiber = Fiber.current;
input.on('data', function(data) {
remaining += data;
var index = remaining.indexOf('\n');
while (index > -1) {
var line = remaining.substring(0, index);
if (line.split('*=')[1]) {
var require_str = jtrain.trim(line.split('*=')[1]);
if (require_str == "require_tree .") {
css_files = fs.readdirSync(ROOT_APP + '/app/assets/stylesheets');
for (var i = 0; i < css_files.length; i++) {
if (css_files[i] != "application.css")
html += ''
}
} else if (require_str == "require_self") {
html += ''
}
InputPortArray.openInputPortArray = function(name) {
var proc = Fiber.current.fbpProc;
var namey = proc.name + '.' + name;
var hi_index = -1;
var array = [];
var re = new RegExp(namey + '\\[(\\d+)\\]');
for (var i = 0; i < proc.inports.length; i++) {
var namex = re.exec(proc.inports[i][0]);
if (namex != null && namex.index == 0) {
hi_index = Math.max(hi_index, namex[1]);
array[namex[1]] = proc.inports[i][1];
}
}
if (hi_index == -1) {
console.log('Port ' + proc.name + '.' + name + ' not found');
module.exports = function(message) {
if(global.trace) {
var calledAs = "";
if(this && this.name) {
calledAs = this.name;
}
var fiberProc = "no-fiber";
if(Fiber.current) {
if(Fiber.current.fbpProc) {
fiberProc = Fiber.current.fbpProc.name;
} else {
fiberProc = "runtime";
}
}
var tag = "[" + fiberProc + "->" + calledAs + "]";
if(fiberProc === calledAs) {
tag = "[" + calledAs + "]";
} else if (!calledAs) {
tag = "[" + fiberProc + "]";
}
console.log(tag + ' ' + message);
}
global[modelName].prototype.update_attributes = function (data) {
for (var k in data) {
this[k] = data[k];
}
var fiber = Fiber.current;
this.save(function (err) {
if (err) return fiber.run(err);
fiber.run(true);
});
return Fiber.yield();
};
global[modelName].prototype.destroy = function () {
export function withContext(fn: () => T, cx: any): T {
if (!fibers.current) throw new Error('withContext(fn) not allowed outside run()');
const oldContext = globals.context;
globals.context = cx || Object.create(oldContext);
try {
return fn();
} finally {
globals.context = oldContext;
}
}
var yield_ = function (expr) {
Fiber.current['value'].resolve(expr);
Fiber.current['done'].resolve(false);
Fiber.yield();
};
module.exports = yield_;
var yield_ = function (expr) {
Fiber.current['value'].resolve(expr);
Fiber.current['done'].resolve(false);
Fiber.yield();
};
module.exports = yield_;