aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-12-31 14:03:29 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-31 14:03:29 -0800
commit491dcb14416c292c4c5e35d98c8bfd9c669ec190 (patch)
tree28aba5d61a41377f3f8dfee8d52bc73b2093a0e1 /emscripten.py
parente5e62a1929bd6ea497c5770faeda712299988cd1 (diff)
forward externals to asm
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/emscripten.py b/emscripten.py
index 50463711..b9f27fe4 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -344,7 +344,8 @@ var i64Math_modulo = function(a, b, c, d, e) { i64Math.modulo(a, b, c, d, e) };
del forwarded_json['Variables']['globals']['_llvm_global_ctors'] # not a true variable
except:
pass
- global_vars = forwarded_json['Variables']['globals'].keys() if settings['NAMED_GLOBALS'] else []
+ # If no named globals, only need externals
+ global_vars = map(lambda g: g['name'], filter(lambda g: settings['NAMED_GLOBALS'] or g['external'], forwarded_json['Variables']['globals'].values()))
global_funcs = ['_' + x for x in forwarded_json['Functions']['libraryFunctions'].keys()]
asm_global_funcs = ''.join([' var ' + g + '=env.' + g + ';\n' for g in basic_funcs + global_funcs])
asm_global_vars = ''.join([' var ' + g + '=env.' + g + '|0;\n' for g in basic_vars + global_vars])