Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
});
function constr($$) {
const proto = Object.create(FramePrototype);
proto.$meta = info;
proto.$$ = $$;
proto.$run = info.handler;
proto.$err = info.errHandler;
const closure = info.func(proto);
closure[metaDataSymbol] = proto;
closure[S.descriptorSymbol] = funcDescr;
// proto[S.descriptorSymbol] = frameDescr;
proto.constructor = closure;
return closure;
}
S.regOpaqueObject(constr, `c#${info.module.name}#${info.name}`);
S.regOpaqueObject(info.handler, `h#${info.module.name}#${info.name}`);
if (info.errHandler)
S.regOpaqueObject(info.errHandler, `eh#${info.module.name}#${info.name}`);
return constr;
}
const proto = Object.create(FramePrototype);
proto.$meta = info;
proto.$$ = $$;
proto.$run = info.handler;
proto.$err = info.errHandler;
const closure = info.func(proto);
closure[metaDataSymbol] = proto;
closure[S.descriptorSymbol] = funcDescr;
// proto[S.descriptorSymbol] = frameDescr;
proto.constructor = closure;
return closure;
}
S.regOpaqueObject(constr, `c#${info.module.name}#${info.name}`);
S.regOpaqueObject(info.handler, `h#${info.module.name}#${info.name}`);
if (info.errHandler)
S.regOpaqueObject(info.errHandler, `eh#${info.module.name}#${info.name}`);
return constr;
}
});
function constr($$) {
const proto = Object.create(FramePrototype);
proto.$meta = info;
proto.$$ = $$;
proto.$run = info.handler;
proto.$err = info.errHandler;
const closure = info.func(proto);
closure[metaDataSymbol] = proto;
closure[S.descriptorSymbol] = funcDescr;
// proto[S.descriptorSymbol] = frameDescr;
proto.constructor = closure;
return closure;
}
S.regOpaqueObject(constr, `c#${info.module.name}#${info.name}`);
S.regOpaqueObject(info.handler, `h#${info.module.name}#${info.name}`);
if (info.errHandler)
S.regOpaqueObject(info.errHandler, `eh#${info.module.name}#${info.name}`);
return constr;
}
create() {
return constr();
},
readContent(ctx, json, value) {
value[metaDataSymbol].$$ = ctx.step(json.$$);
},
write(ctx, value) {
const json = {};
const proto = value[metaDataSymbol];
json.$$ = ctx.step(proto.$$, json, "$$");
return json;
},
overrideProps: { [metaDataSymbol]: false },
typeofHint: "function"
});
const frameDescr = S.regDescriptor({
name: `f@${info.module.name}#${info.name}`,
readContent(ctx, json, value) {
value.$ = ctx.step(json.$);
},
create(ctx, json) {
const closure = ctx.step(json.constr);
const proto = closure[metaDataSymbol];
return Object.create(proto);
},
write(ctx, value) {
const json = {};
// json.constr = ctx.step(value.constructor, json, "constr");
return json;
}
});
function constr($$) {
function constr($$) {
const proto = Object.create(FramePrototype);
proto.$meta = info;
proto.$$ = $$;
proto.$run = info.handler;
proto.$err = info.errHandler;
const closure = info.func(proto);
closure[metaDataSymbol] = proto;
closure[S.descriptorSymbol] = funcDescr;
// proto[S.descriptorSymbol] = frameDescr;
proto.constructor = closure;
return closure;
}
S.regOpaqueObject(constr, `c#${info.module.name}#${info.name}`);
export function regModule(exp, name) {
if (exp[S.descriptorSymbol]) return;
if (!name) name = "?";
if (typeof exp === "object" || typeof exp === "function")
S.regOpaqueObject(exp, `module#${name}`);
for (const i in exp) {
const f = exp[i];
if (!f) continue;
const ty = typeof f;
if (ty === "function" || ty === "object")
S.regOpaqueObject(f, `export#${name}#${i}`);
else if (ty === "symbol" && !Symbol.keyFor(f))
S.regOpaquePrim(f, `export#${name}#${i}`);
}
}
resume() {
try {
const arg = context.value;
context.value = void 0;
return this.$run(arg);
} catch (e) {
this.$state = this.$err(this.$state);
context.brk = "throw";
context.error = true;
context.value = e;
return token;
}
}
};
S.regOpaqueObject(FramePrototype, "debugger#frame");
function defaultErrHandler() {
return 1;
}
export function frame(proto) {
const res = Object.create(proto);
res.$ = {};
return res;
}
export function constr(v) {
return v;
}
export function brk(name, descr) {
) {
if (!name) name = "*";
if (!errHandler) errHandler = defaultErrHandler;
const info = {
module,
func,
handler,
errHandler,
finHandler,
name,
loc,
parent,
scope
};
const wrap = wrapMeta(info);
S.regOpaqueObject(info, `i#${info.module.name}#${info.name}`);
module.functions.push(info);
return wrap;
}
export const region = func => {
const ret = function(...args) {
try {
context.syncStack.push([context.stack, context.sync]);
context.stack = null;
context.sync = true;
return func.apply(this, args);
} finally {
[context.stack, context.sync] = context.syncStack.pop();
}
};
S.regOpaqueObject(ret, `region${func.name || "?"}`);
return ret;
};
import * as Trace from "./trace.js";
Trace.TraceData.prototype[S.descriptorSymbol] = S.NotSerializableDescriptor;
Kit.regModule(RT, "@effectful/debugger/rt");
Kit.regModule(Trace, "@effectful/debugger/trace");
for (const i of Object.values(RT)) {
const meta = i && i[Kit.metaDataSymbol];
if (meta) meta.canSkip = true;
}
export const exports = RT.exports;
export const imports = RT.imports;
export const chainM = RT.chainM;
export const Serialization = S;
S.regOpaquePrim(Kit.metaDataSymbol, "@effectful/debugger/metaData");
S.regOpaquePrim(Kit.thunkSymbol, "@effectful/debugger/thunk");
S.regOpaqueObject(Symbol.for, "Symbol.for");
S.regOpaqueObject(Symbol.keyFor, "Symbol.keyFor");
S.regOpaquePrim(Symbol.iterator, "SymbolStatic.iterator");
S.regOpaquePrim(Symbol.asyncIterator, "SymbolStatic.asyncIterator");
S.regOpaquePrim(Symbol.toStringTag, "SymbolStatic.asyncIterator");