Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function compile(source) {
var module = assemblyscript_1.Compiler.compileString(source, {
target: assemblyscript_1.CompilerTarget.WASM32,
memoryModel: assemblyscript_1.CompilerMemoryModel.MALLOC,
silent: true
});
var wasmFile;
if (!module) {
throw Error('compilation failed');
}
module.optimize();
if (!module.validate()) {
throw Error('validation failed');
}
wasmFile = module.emitBinary();
module.dispose();
return new Buffer(wasmFile);
}
/**