diff --git a/cli/index.js b/cli/index.js index 1c1e435ca4..55aac5bd0b 100644 --- a/cli/index.js +++ b/cli/index.js @@ -304,6 +304,7 @@ export async function main(argv, options) { default: runtime = 2; break; } assemblyscript.setTarget(compilerOptions, 0); + assemblyscript.setDebugInfo(compilerOptions, !!opts.debug); assemblyscript.setRuntime(compilerOptions, runtime); assemblyscript.setNoAssert(compilerOptions, opts.noAssert); assemblyscript.setExportMemory(compilerOptions, !opts.noExportMemory); diff --git a/src/compiler.ts b/src/compiler.ts index 16454f998c..2ba4992869 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -225,6 +225,8 @@ export class Options { target: Target = Target.WASM32; /** Runtime type. Defaults to Incremental GC. */ runtime: Runtime = Runtime.Incremental; + /** If true, indicates that debug information will be emitted by Binaryen. */ + debugInfo: bool = false; /** If true, replaces assertions with nops. */ noAssert: bool = false; /** It true, exports the memory to the embedder. */ diff --git a/src/index-wasm.ts b/src/index-wasm.ts index 80cbcb24f8..acb9af0a79 100644 --- a/src/index-wasm.ts +++ b/src/index-wasm.ts @@ -227,6 +227,10 @@ export function setPedantic(options: Options, pedantic: bool): void { options.pedantic = pedantic; } +export function setDebugInfo(options: Options, debug: bool): void { + options.debugInfo = debug; +} + // Program /** Creates a new Program. */