aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-12 17:40:35 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-12 17:40:35 -0800
commitdb386b079146ce333145e7470d82bb843591cf2a (patch)
tree4e2122098c4ed4b85149f431e81704c77bec8f20 /emscripten.py
parent0bb7d8093a98b8bd41b9eeeaf8bde671f0b9894e (diff)
export named globals from fastcomp to js
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/emscripten.py b/emscripten.py
index 1a3bddd7..8ddb7375 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -873,6 +873,10 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
if key in all_exported_functions or export_all or (export_bindings and key.startswith('_emscripten_bind')):
exported_implemented_functions.add(key)
+ # Add named globals
+ named_globals = '\n'.join(['var %s = %s;' % (k, v) for k, v in metadata['namedGlobals'].iteritems()])
+ pre = pre.replace('// === Body ===', '// === Body ===\n' + named_globals + '\n')
+
#if DEBUG: outfile.write('// pre\n')
outfile.write(pre)
pre = None