Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
iterate(memo: VersionedPathReference, value: VersionedPathReference): TryOpcode {
let stack = this.stack;
stack.push(value);
stack.push(memo);
let state = this.capture(2);
let tracker = this.elements().pushUpdatableBlock();
// let ip = this.ip;
// this.ip = end + 4;
// this.frames.push(ip);
return new TryOpcode(this.heap.gethandle(this.pc), state, tracker, new LinkedList());
}
static empty(
program: RuntimeProgram,
env: Environment,
elementStack: ElementBuilder
) {
let dynamicScope: DynamicScope = {
get() { return UNDEFINED_REFERENCE; },
set() { return UNDEFINED_REFERENCE; },
child() { return dynamicScope; }
};
let vm = new VM(program, env, Scope.root(UNDEFINED_REFERENCE, 0), dynamicScope, elementStack);
vm.updatingOpcodeStack.push(new LinkedList());
return vm;
}
enterList(relativeStart: number) {
let updating = new LinkedList();
let state = this.capture(0);
let tracker = this.elements().pushBlockList(updating);
let artifacts = this.stack.peek().artifacts;
let addr = (this.pc + relativeStart) - this.currentOpSize;
let start = this.heap.gethandle(addr);
let opcode = new ListBlockOpcode(start, state, tracker, updating, artifacts);
this.listBlockStack.push(opcode);
this.didEnter(opcode);
}
enter(args: number) {
let updating = new LinkedList();
let state = this.capture(args);
let tracker = this.elements().pushUpdatableBlock();
let tryOpcode = new TryOpcode(this.heap.gethandle(this.pc), state, tracker, updating);
this.didEnter(tryOpcode);
}
static initial(
program: RuntimeProgram,
env: Environment,
self: PathReference,
dynamicScope: DynamicScope,
elementStack: ElementBuilder,
handle: number
) {
let scopeSize = program.heap.scopesizeof(handle);
let scope = Scope.root(self, scopeSize);
let vm = new VM(program, env, scope, dynamicScope, elementStack);
vm.pc = vm.heap.getaddr(handle);
vm.updatingOpcodeStack.push(new LinkedList());
return vm;
}