aboutsummaryrefslogtreecommitdiff
path: root/emlink.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-06-28 14:21:45 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-07-03 15:31:03 -0700
commit11db72239d48da525e0978a608e4cdfb91168981 (patch)
treeccb07b0571c8b4305544eeb4e333ceb224f4f3f3 /emlink.py
parent0de466d64e4cf3e8466c03731f18012688d5ea78 (diff)
apply replacements to module defs, and add testing for merging of overlapping global initializers
Diffstat (limited to 'emlink.py')
-rw-r--r--emlink.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/emlink.py b/emlink.py
index 66c81342..f37e8253 100644
--- a/emlink.py
+++ b/emlink.py
@@ -146,7 +146,14 @@ class AsmModule():
main.exports_js = 'return {' + ','.join(list(exports)) + '};\n})\n'
# post
- new_module_defs = self.module_defs.difference(main.module_defs)
+ def rep_def(deff):
+ key = deff.split(' ')[1]
+ if key in replacements:
+ rep = replacements[key]
+ return 'var %s = Module["%s"] = asm["%s"];\n' % (rep, rep, rep)
+ return deff
+ my_module_defs = map(rep_def, self.module_defs)
+ new_module_defs = set(my_module_defs).difference(main.module_defs)
if len(new_module_defs) > 0:
position = main.post_js.find('Runtime.') # Runtime is the start of the hardcoded ones
main.post_js = main.post_js[:position] + ''.join(list(new_module_defs)) + '\n' + main.post_js[position:]