aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-18 11:56:22 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-18 11:56:22 -0800
commitc9625dea12ca07fee75a3934f741c9a54d1d2113 (patch)
treebc7ad93924a6cc7e0d1df8d71b81b6708f91cdb0 /emscripten.py
parent54ef788e6c12facf6927653f65b9e8666b8d9bea (diff)
fix function table dummy element coercions
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/emscripten.py b/emscripten.py
index f061cfaf..dd3b32af 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -305,8 +305,8 @@ def emscript(infile, settings, outfile, libraries=[]):
Counter.i += 1
bad = 'b' + str(i)
params = ','.join(['p%d' % p for p in range(len(sig)-1)])
- coercions = ';'.join(['p%d = %sp%d%s' % (p, '+' if sig[p+1] == 'd' else '', p, '' if sig[p+1] == 'd' else '|0') for p in range(len(sig)-1)]) + ';'
- ret = '' if sig[0] == 'v' else ('return %s0' % ('+' if sig[0] == 'd' else ''))
+ coercions = ';'.join(['p%d = %sp%d%s' % (p, '+' if sig[p+1] == 'f' else '', p, '' if sig[p+1] == 'f' else '|0') for p in range(len(sig)-1)]) + ';'
+ ret = '' if sig[0] == 'v' else ('return %s0' % ('+' if sig[0] == 'f' else ''))
return ('function %s(%s) { %s abort(%d); %s };' % (bad, params, coercions, i, ret), raw.replace('[0,', '[' + bad + ',').replace(',0,', ',' + bad + ',').replace(',0,', ',' + bad + ',').replace(',0]', ',' + bad + ']').replace(',0]', ',' + bad + ']'))
infos = [make_table(sig, raw) for sig, raw in last_forwarded_json['Functions']['tables'].iteritems()]
function_tables_defs = '\n'.join([info[0] for info in infos] + [info[1] for info in infos])