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 createCompiledModule(ast: Program): CompiledModule {
const exports: Array = [];
const imports = [];
let start;
// Do compile-time ast manipulation in order to remove WAST
// semantics during execution
denormalizeTypeReferences(ast);
wastIdentifierToIndex(ast);
validateAST(ast);
t.traverse(ast, {
ModuleExport({ node }: NodePath) {
if (node.descr.exportType === "Func") {
exports.push({
name: node.name,
kind: "function"
});
}
},
Start({ node }: NodePath) {
if (typeof start !== "undefined") {
throw new CompileError("Multiple start functions is not allowed");
}