From bea5e59901eb10a8983bdab106dd83436274dfb0 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Fri, 19 Aug 2022 08:13:30 +0300 Subject: [PATCH 1/4] add debugInfo for Options --- cli/index.js | 1 + src/compiler.ts | 2 ++ src/index-wasm.ts | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/cli/index.js b/cli/index.js index 1c1e435ca4..c0a057edc6 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(opts.debug != null); 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..b7d9154768 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, binaryen don't apply mangling and don't remove specific sections. */ + 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. */ From afa5b3ea5d5cd20d4a204ee4499d5fbcea7d97c5 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Fri, 19 Aug 2022 08:16:28 +0300 Subject: [PATCH 2/4] better --- cli/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/index.js b/cli/index.js index c0a057edc6..dd6d40f340 100644 --- a/cli/index.js +++ b/cli/index.js @@ -304,7 +304,7 @@ export async function main(argv, options) { default: runtime = 2; break; } assemblyscript.setTarget(compilerOptions, 0); - assemblyscript.setDebugInfo(opts.debug != null); + assemblyscript.setDebugInfo(!!opts.debug); assemblyscript.setRuntime(compilerOptions, runtime); assemblyscript.setNoAssert(compilerOptions, opts.noAssert); assemblyscript.setExportMemory(compilerOptions, !opts.noExportMemory); From f522977914e81e05755a792de6463d22d1b21f48 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Fri, 19 Aug 2022 08:17:19 +0300 Subject: [PATCH 3/4] fix --- cli/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/index.js b/cli/index.js index dd6d40f340..55aac5bd0b 100644 --- a/cli/index.js +++ b/cli/index.js @@ -304,7 +304,7 @@ export async function main(argv, options) { default: runtime = 2; break; } assemblyscript.setTarget(compilerOptions, 0); - assemblyscript.setDebugInfo(!!opts.debug); + assemblyscript.setDebugInfo(compilerOptions, !!opts.debug); assemblyscript.setRuntime(compilerOptions, runtime); assemblyscript.setNoAssert(compilerOptions, opts.noAssert); assemblyscript.setExportMemory(compilerOptions, !opts.noExportMemory); From c3499b13c3c45f5ccc3ca1a7208361029a6a351e Mon Sep 17 00:00:00 2001 From: Max Graey Date: Fri, 19 Aug 2022 17:41:11 +0300 Subject: [PATCH 4/4] Update src/compiler.ts Co-authored-by: dcode --- src/compiler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler.ts b/src/compiler.ts index b7d9154768..2ba4992869 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -225,7 +225,7 @@ export class Options { target: Target = Target.WASM32; /** Runtime type. Defaults to Incremental GC. */ runtime: Runtime = Runtime.Incremental; - /** If true, binaryen don't apply mangling and don't remove specific sections. */ + /** If true, indicates that debug information will be emitted by Binaryen. */ debugInfo: bool = false; /** If true, replaces assertions with nops. */ noAssert: bool = false;