aboutsummaryrefslogtreecommitdiff
path: root/emlink.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-06-25 18:15:51 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-07-03 15:31:03 -0700
commit405928b6971d536c14b886eb3908c4a8b9351a9e (patch)
tree2176bbdde45641b440f331e9ee195e248696e821 /emlink.py
parent20e81c40735a5c98672900d3793f1cc8452b2471 (diff)
merge exports
Diffstat (limited to 'emlink.py')
-rw-r--r--emlink.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/emlink.py b/emlink.py
index 06ef0062..e3943578 100644
--- a/emlink.py
+++ b/emlink.py
@@ -64,9 +64,11 @@ class AsmModule():
ret = post_js.find('return')
self.tables_js = post_js[:ret]
self.exports_js = post_js[ret:]
+ self.exports = set([export.strip() for export in self.exports_js[self.exports_js.find('{')+1:self.exports_js.find('}')].split(',')])
+ #print >> sys.stderr, self.exports
def relocate_into(self, main):
- # heap initializer TODO
+ # heap initializer
concat = '.concat(' if main.mem_init_js and self.mem_init_js else ''
end = ')' if main.mem_init_js and self.mem_init_js else ''
allocation = main.mem_init_js + concat + self.mem_init_js + end
@@ -102,7 +104,9 @@ class AsmModule():
# tables TODO
- # exports TODO
+ # exports
+ exports = main.exports.union(self.exports)
+ main.exports_js = 'return {' + ','.join(list(exports)) + '};\n})\n'
def write(self, out):
f = open(out, 'w')