Skip to content

Commit 86d6e0e

Browse files
authored
fix a refactoring regression in emcc.py: the 'final' variable is a global, and we use it when save_intermediate. if we pass and return it to do_binaryen, then save_intermediate does not save the current final file, it saves the last one in the global 'final' var. not a user-noticeable difference, but in debugging it can be confusing (#5894)
1 parent 5118a1e commit 86d6e0e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

emcc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,8 +1832,8 @@ def get_eliminate():
18321832

18331833
binaryen_method_sanity_check()
18341834
if shared.Settings.BINARYEN:
1835-
final = do_binaryen(final, target, asm_target, options, memfile, wasm_binary_target,
1836-
wasm_text_target, misc_temp_files, optimizer)
1835+
do_binaryen(target, asm_target, options, memfile, wasm_binary_target,
1836+
wasm_text_target, misc_temp_files, optimizer)
18371837

18381838
if shared.Settings.MODULARIZE:
18391839
final = modularize(final)
@@ -2228,8 +2228,9 @@ def binaryen_method_sanity_check():
22282228
exit_with_error('Unrecognized BINARYEN_METHOD "' + m.strip() + '" specified! Please pass a comma-delimited list containing one or more of: ' + ','.join(valid_methods))
22292229

22302230

2231-
def do_binaryen(final, target, asm_target, options, memfile, wasm_binary_target,
2231+
def do_binaryen(target, asm_target, options, memfile, wasm_binary_target,
22322232
wasm_text_target, misc_temp_files, optimizer):
2233+
global final
22332234
logging.debug('using binaryen, with method: ' + shared.Settings.BINARYEN_METHOD)
22342235
binaryen_bin = shared.Building.get_binaryen_bin()
22352236
# Emit wasm.js at the top of the js. This is *not* optimized with the rest of the code, since
@@ -2395,7 +2396,6 @@ def do_binaryen(final, target, asm_target, options, memfile, wasm_binary_target,
23952396
shared.try_delete(target)
23962397
f.write(js)
23972398
f.close()
2398-
return final
23992399

24002400

24012401
def modularize(final):

0 commit comments

Comments
 (0)