Skip to content

Commit c59f752

Browse files
authored
[embind] Fix TS generation when using AOT JS. (emscripten-core#22563)
Some AOT JS was ending up in the TS definition file because the setting to turn AOT JS was wrong.
1 parent 52e8c4b commit c59f752

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

test/test_other.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3359,11 +3359,15 @@ def test_jspi_add_function(self):
33593359
'-Wno-experimental']
33603360
self.do_runf('other/test_jspi_add_function.c', 'done')
33613361

3362-
def test_embind_tsgen(self):
3362+
@parameterized({
3363+
'': [[]],
3364+
'with_jsgen': [['-sEMBIND_AOT']]
3365+
})
3366+
def test_embind_tsgen(self, opts):
33633367
# Check that TypeScript generation works and that the program is runs as
33643368
# expected.
33653369
self.do_runf('other/embind_tsgen.cpp', 'main ran',
3366-
emcc_args=['-lembind', '--emit-tsd', 'embind_tsgen.d.ts'])
3370+
emcc_args=['-lembind', '--emit-tsd', 'embind_tsgen.d.ts'] + opts)
33673371

33683372
# Test that the output compiles with a TS file that uses the defintions.
33693373
cmd = shared.get_npm_cmd('tsc') + ['embind_tsgen.d.ts', '--noEmit']

tools/link.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,7 @@ def phase_emit_tsd(options, wasm_target, js_target, js_syms, metadata, linker_in
19991999
filename = options.emit_tsd
20002000
embind_tsd = ''
20012001
if settings.EMBIND:
2002-
embind_tsd = run_embind_gen(wasm_target, js_syms, {'EMBIND_JS': False}, linker_inputs)
2002+
embind_tsd = run_embind_gen(wasm_target, js_syms, {'EMBIND_AOT': False}, linker_inputs)
20032003
all_tsd = emscripten.create_tsd(metadata, embind_tsd)
20042004
out_file = os.path.join(os.path.dirname(js_target), filename)
20052005
write_file(out_file, all_tsd)

0 commit comments

Comments
 (0)