Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!exited) {
nextTick (_cb, _err, _env, null, null);
exited = true;
}
}
let $catch = (_errclass, catchFn) => {
if (err instanceof _errclass)
catchFn();
}
let $yield = (retval) => {
nextTick (_cb, null, _env, null, retval);
}
nextTick (f, $return, $throw, $catch, $yield, _env.par, ...args);
}
}
nextTick (evalAsync, p.parse(), _env, (err, _env, _cb, val) => {
_env.defc('__base_dir__', basedir);
nextTick (cb, null, _env, null, null);
});
}
constructor (core, env) {
this.__itype__ = 'stream';
this.env = env;
this.core = core;
this.value = undefined;
this.callbacks = [];
this.addcb = (cb) => { this.callbacks.push(cb); }
this.push = (val) => {
this.value = val;
if (val !== null && val !== undefined) for (let cb of this.callbacks)
nextTick (cb, null, this.env, null, val);
}
nextTick (this.core, (val) => {
this.value = val;
if (val !== null && val !== undefined) for (let cb of this.callbacks)
nextTick (cb, null, this.env, null, val);
});
}
nextTick (evalAsync, xarray[0], env, (err, env, _, func) => {
if (func instanceof Object && func.__itype__ === "env") {
let acell = x.cdr;
let reduced = func.rho.reduce (acell, env);
if (reduced === null) //cb( null, env, null, null);
evalAsync ( Cell.list(xarray.slice(1)), env, cb);
else
nextTick (evalAsync, reduced, env, cb);
}
else if (func instanceof Object && func.__itype__ === 'stream') {
func.addcb(cb)
cb( err, env, null, func.value);
}
else if (func instanceof Object && func.__itype__ === 'specialform') {
func = func.func;
let args = xarray.slice(1);
let _env = new Env (null, null, env);
func (null, _env, cb, ...args);
}
else if (func instanceof Function) {
let args = xarray.slice(1);
if (imported.has(filename)) {
let importEnv = imported.get(filename);
if (namesList) {
if (namesList instanceof Cell) {
while (namesList instanceof Cell) {
_env.syncAndBind(namesList.car, importEnv.get(namesList.car));
namesList = namesList.cdr;
}
}
else if (_all.equal(namesList)) _env.map = new Map([..._env.map, ...importEnv.map]);
}
nextTick (cb, null, _env, null, importEnv);
}
else {
_env.defc('__base_dir__', sourceDir);
nextTick (readSource, err, _env, (err, __env, _cb, src) => {
_env.defc('__base_dir__', basedir);
let p = new Parser ({name:sourcename, buffer:src});
let execenv = new Env (null, null, env);
execenv.defc('__base_dir__', sourceDir);
nextTick (evalAsync, p.parse(), execenv, (err, importEnv, _cb, val) => {
imported.set (filename, importEnv);
if (namesList) {
if (namesList instanceof Cell) {
while (namesList instanceof Cell) {
_env.syncAndBind(namesList.car, importEnv.get(namesList.car));
namesList = namesList.cdr;
}
}
export function _eval (err, env, cb, src, name) {
if (!name) name = 'unnamed';
let p = new Parser ({name: name, buffer: src});
nextTick (evalAsync, p.parse(), globalenv(), (err, _env, _cb, val) => {
if (cb) nextTick (cb, err, env, null, _env);
});
}
evalAsync( args[i], _env, (err, __env, _, argval) => {
i += 1;
nextTick (callback, err, argval);
});
},
function _readsource (err, env, cb, id) {
let source = document.getElementById(id).text;
nextTick(cb, null, env, null, source);
}
env.bind(new IronSymbol ('_readsource'), _readsource);
export function fx (err, env, cb, f) {
if (err) cb (err);
nextTick (cb, null, env, null, ( err, _env, _cb, ...args) => {
let val = f(...args);
nextTick (_cb, null, _env, null, val);
});
}
nextTick (evalAsync, p.parse(), execenv, (err, importEnv, _cb, val) => {
imported.set (filename, importEnv);
if (namesList) {
if (namesList instanceof Cell) {
while (namesList instanceof Cell) {
_env.syncAndBind(namesList.car, importEnv.get(namesList.car));
namesList = namesList.cdr;
}
}
else if (_all.equal(namesList)) _env.map = new Map([..._env.map, ...importEnv.map]);
}
nextTick (cb, null, _env, null, importEnv);
});
} , basename(sourcename));