Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let position = check(vm.fetchValue(register), CheckNumber) - offset;
vm.stack.dup(position);
},
OpcodeKind.Mut
);
APPEND_OPCODES.add(
Op.Pop,
(vm, { op1: count }) => {
vm.stack.popN(count);
},
OpcodeKind.Mut
);
APPEND_OPCODES.add(
Op.Load,
(vm, { op1: register }) => {
vm.load(register);
},
OpcodeKind.Mut
);
APPEND_OPCODES.add(
Op.Fetch,
(vm, { op1: register }) => {
vm.fetch(register);
},
OpcodeKind.Mut
);
APPEND_OPCODES.add(
Op.BindDynamicScope,
APPEND_OPCODES.add(Op.PrimitiveReference, vm => {
let stack = vm.stack;
stack.push(PrimitiveReference.create(check(stack.pop(), CheckPrimitive)));
});
APPEND_OPCODES.add(Op.Dup, (vm, { op1: register, op2: offset }) => {
let position = check(vm.fetchValue(register), CheckNumber) - offset;
vm.stack.dup(position);
});
APPEND_OPCODES.add(Op.Pop, (vm, { op1: count }) => {
vm.stack.pop(count);
});
APPEND_OPCODES.add(Op.Load, (vm, { op1: register }) => {
vm.load(register);
});
APPEND_OPCODES.add(Op.Fetch, (vm, { op1: register }) => {
vm.fetch(register);
});
APPEND_OPCODES.add(Op.BindDynamicScope, (vm, { op1: _names }) => {
let names = vm.constants.getArray(_names);
vm.bindDynamicScope(names);
});
APPEND_OPCODES.add(Op.PushFrame, vm => {
vm.pushFrame();
check(vm.stack.peek(), CheckNumber);