@@ -225,7 +225,7 @@ def set_memory(static_bump):
225225
226226def report_missing_exports_wasm_only (metadata ):
227227 if diagnostics .is_enabled ('undefined' ):
228- defined_symbols = set ( asmjs_mangle (e ) for e in metadata .all_exports )
228+ defined_symbols = { asmjs_mangle (e ) for e in metadata .all_exports }
229229 missing = set (settings .USER_EXPORTS ) - defined_symbols
230230 for symbol in sorted (missing ):
231231 diagnostics .warning ('undefined' , f'undefined exported symbol: "{ symbol } "' )
@@ -235,7 +235,7 @@ def report_missing_exports(js_symbols):
235235 if diagnostics .is_enabled ('undefined' ):
236236 # Report any symbol that was explicitly exported but is present neither
237237 # as a native function nor as a JS library function.
238- defined_symbols = set ( asmjs_mangle (e ) for e in settings .WASM_EXPORTS ) .union (js_symbols )
238+ defined_symbols = { asmjs_mangle (e ) for e in settings .WASM_EXPORTS } .union (js_symbols )
239239 missing = set (settings .USER_EXPORTS ) - defined_symbols
240240 for symbol in sorted (missing ):
241241 diagnostics .warning ('undefined' , f'undefined exported symbol: "{ symbol } "' )
@@ -699,15 +699,12 @@ def create_asm_consts(metadata):
699699 asm_consts = {}
700700 for addr , const in metadata .em_asm_consts .items ():
701701 body = trim_asm_const_body (const )
702- args = []
703702 max_arity = 16
704703 arity = 0
705704 for i in range (max_arity ):
706- if ( '$' + str ( i )) in const :
705+ if f'$ { i } ' in const :
707706 arity = i + 1
708- for i in range (arity ):
709- args .append ('$' + str (i ))
710- args = ', ' .join (args )
707+ args = ', ' .join (f"${ i } " for i in range (arity ))
711708 if 'arguments' in body :
712709 # arrow functions don't bind `arguments` so we have to use
713710 # the old function syntax in this case
@@ -717,8 +714,7 @@ def create_asm_consts(metadata):
717714 if settings .RELOCATABLE :
718715 addr += settings .GLOBAL_BASE
719716 asm_consts [addr ] = func
720- asm_consts = [(key , value ) for key , value in asm_consts .items ()]
721- asm_consts .sort ()
717+ asm_consts = sorted (asm_consts .items ())
722718 return asm_consts
723719
724720
@@ -836,10 +832,8 @@ def add_standard_wasm_imports(send_items_map):
836832
837833def create_sending (metadata , library_symbols ):
838834 # Map of wasm imports to mangled/external/JS names
839- send_items_map = {}
835+ send_items_map = {name : name for name in metadata . invoke_funcs }
840836
841- for name in metadata .invoke_funcs :
842- send_items_map [name ] = name
843837 for name in metadata .imports :
844838 if name in metadata .em_js_funcs :
845839 send_items_map [name ] = name
@@ -903,9 +897,7 @@ def install_wrapper(sym):
903897 # pthread_self and _emscripten_proxy_execute_task_queue are currently called in some
904898 # cases after the runtime has exited.
905899 # TODO: Look into removing these, and improving our robustness around thread termination.
906- if sym in ('__trap' , 'pthread_self' , '_emscripten_proxy_execute_task_queue' ):
907- return False
908- return True
900+ return sym not in {'__trap' , 'pthread_self' , '_emscripten_proxy_execute_task_queue' }
909901
910902 for name , types in function_exports .items ():
911903 nargs = len (types .params )
0 commit comments