Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function evaluate(
allocator: Allocator,
code: Array
): ?StackLocal {
const ir = listOfInstructionsToIr(code);
// Create an empty module instance for the context
const moduleInstance = modulevalue.createInstance(
ir,
allocator,
t.module(undefined, [])
);
const stackFrame = createStackFrame([], moduleInstance, allocator);
const main = ir.funcTable.find(f => f.name === "main");
assert(typeof main === "object");
return executeStackFrame(ir, main.startAt, stackFrame);
}
export function compileASTNodes(nodes: Array): IR {
nodes.push(instruction("end"));
addFakeLocsListOfInstructions(nodes);
return listOfInstructionsToIr(nodes);
}