@@ -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 }  "' )
@@ -346,10 +346,7 @@ def emscript(in_wasm, out_wasm, outfile_js, js_syms, finalize=True, base_metadat
346346
347347    for  em_js_func , raw  in  metadata .em_js_funcs .items ():
348348      c_sig  =  raw .split ('<::>' )[0 ].strip ('()' )
349-       if  not  c_sig  or  c_sig  ==  'void' :
350-         c_sig  =  []
351-       else :
352-         c_sig  =  c_sig .split (',' )
349+       c_sig  =  [] if  not  c_sig  or  c_sig  ==  'void'  else  c_sig .split (',' )
353350      if  em_js_func  in  import_map :
354351        imp  =  import_map [em_js_func ]
355352        assert  imp .kind  ==  webassembly .ExternType .FUNC 
@@ -646,11 +643,8 @@ def create_tsd_exported_runtime_methods(metadata):
646643  tsc_output_file  =  in_temp ('jsdoc.d.ts' )
647644  utils .write_file (js_doc_file , js_doc )
648645  tsc  =  shutil .which ('tsc' )
649-   if  tsc :
650-     # Use the full path from the which command so windows can find tsc. 
651-     tsc  =  [tsc ]
652-   else :
653-     tsc  =  shared .get_npm_cmd ('tsc' )
646+   # Use the full path from the which command so windows can find tsc. 
647+   tsc  =  [tsc ] if  tsc  else  shared .get_npm_cmd ('tsc' )
654648  cmd  =  tsc  +  ['--outFile' , tsc_output_file , '--declaration' , '--emitDeclarationOnly' , '--allowJs' , js_doc_file ]
655649  shared .check_call (cmd , cwd = path_from_root ())
656650  return  utils .read_file (tsc_output_file )
@@ -699,15 +693,12 @@ def create_asm_consts(metadata):
699693  asm_consts  =  {}
700694  for  addr , const  in  metadata .em_asm_consts .items ():
701695    body  =  trim_asm_const_body (const )
702-     args  =  []
703696    max_arity  =  16 
704697    arity  =  0 
705698    for  i  in  range (max_arity ):
706-       if  ( '$'   +   str ( i ))  in  const :
699+       if  f'$ { i } '   in  const :
707700        arity  =  i  +  1 
708-     for  i  in  range (arity ):
709-       args .append ('$'  +  str (i ))
710-     args  =  ', ' .join (args )
701+     args  =  ', ' .join (f"${ i }  "  for  i  in  range (arity ))
711702    if  'arguments'  in  body :
712703      # arrow functions don't bind `arguments` so we have to use 
713704      # the old function syntax in this case 
@@ -717,8 +708,7 @@ def create_asm_consts(metadata):
717708    if  settings .RELOCATABLE :
718709      addr  +=  settings .GLOBAL_BASE 
719710    asm_consts [addr ] =  func 
720-   asm_consts  =  [(key , value ) for  key , value  in  asm_consts .items ()]
721-   asm_consts .sort ()
711+   asm_consts  =  sorted (asm_consts .items ())
722712  return  asm_consts 
723713
724714
@@ -762,10 +752,7 @@ def create_em_js(metadata):
762752    assert  separator  in  raw 
763753    args , body  =  raw .split (separator , 1 )
764754    args  =  args [1 :- 1 ]
765-     if  args  ==  'void' :
766-       args  =  []
767-     else :
768-       args  =  args .split (',' )
755+     args  =  [] if  args  ==  'void'  else  args .split (',' )
769756    arg_names  =  [arg .split ()[- 1 ].replace ('*' , '' ) for  arg  in  args  if  arg ]
770757    args  =  ',' .join (arg_names )
771758    func  =  f'function { name }  ({ args }  ) { body }  ' 
@@ -836,10 +823,8 @@ def add_standard_wasm_imports(send_items_map):
836823
837824def  create_sending (metadata , library_symbols ):
838825  # Map of wasm imports to mangled/external/JS names 
839-   send_items_map  =  {}
826+   send_items_map  =  {name :  name   for   name   in   metadata . imports }
840827
841-   for  name  in  metadata .invoke_funcs :
842-     send_items_map [name ] =  name 
843828  for  name  in  metadata .imports :
844829    if  name  in  metadata .em_js_funcs :
845830      send_items_map [name ] =  name 
@@ -903,9 +888,7 @@ def install_wrapper(sym):
903888    # pthread_self and _emscripten_proxy_execute_task_queue are currently called in some 
904889    # cases after the runtime has exited. 
905890    # 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 
891+     return  not  sym  in  ('__trap' , 'pthread_self' , '_emscripten_proxy_execute_task_queue' )
909892
910893  for  name , types  in  function_exports .items ():
911894    nargs  =  len (types .params )
0 commit comments