@@ -269,10 +269,6 @@ def trim_asm_const_body(body):
269
269
return body
270
270
271
271
272
- def create_other_export_declarations (tag_exports ):
273
- return '\n ' .join (f'var { asmjs_mangle (name )} ;' for name in tag_exports )
274
-
275
-
276
272
def create_global_exports (global_exports ):
277
273
lines = []
278
274
for k , v in global_exports .items ():
@@ -953,6 +949,8 @@ def create_receiving(function_exports, tag_exports, library_symbols):
953
949
# function assignWasmExports(wasmExport) {
954
950
# _main = wasmExports["_main"];
955
951
exports = {name : sig for name , sig in function_exports .items () if name != building .WASM_CALL_CTORS }
952
+ for t in tag_exports :
953
+ exports [t ] = None
956
954
957
955
if settings .ASSERTIONS :
958
956
# In debug builds we generate trapping functions in case
@@ -979,16 +977,17 @@ def create_receiving(function_exports, tag_exports, library_symbols):
979
977
980
978
receiving .append ('\n function assignWasmExports(wasmExports) {' )
981
979
for sym , sig in exports .items ():
980
+ is_function = sig is not None
982
981
mangled = asmjs_mangle (sym )
983
- if generate_dyncall_assignment and sym .startswith ('dynCall_' ):
982
+ if generate_dyncall_assignment and is_function and sym .startswith ('dynCall_' ):
984
983
sig_str = sym .replace ('dynCall_' , '' )
985
984
dynCallAssignment = f"dynCalls['{ sig_str } '] = "
986
985
else :
987
986
dynCallAssignment = ''
988
987
export_assignment = ''
989
988
if (settings .MODULARIZE or not settings .MINIMAL_RUNTIME ) and should_export (mangled ) and settings .MODULARIZE != 'instance' :
990
989
export_assignment = f"Module['{ mangled } '] = "
991
- if install_debug_wrapper (sym ):
990
+ if is_function and install_debug_wrapper (sym ):
992
991
nargs = len (sig .params )
993
992
receiving .append (f" { export_assignment } { dynCallAssignment } { mangled } = createExportWrapper('{ sym } ', { nargs } );" )
994
993
else :
@@ -1010,8 +1009,6 @@ def create_module(metadata, function_exports, global_exports, tag_exports, libra
1010
1009
if settings .WASM_ESM_INTEGRATION :
1011
1010
module .append (sending )
1012
1011
else :
1013
- module .append (create_other_export_declarations (tag_exports ))
1014
-
1015
1012
if settings .PTHREADS or settings .WASM_WORKERS or (settings .IMPORTED_MEMORY and settings .MODULARIZE == 'instance' ):
1016
1013
sending = textwrap .indent (sending , ' ' ).strip ()
1017
1014
module .append ('''\
0 commit comments