diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-16 16:32:53 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-16 16:32:53 -0800 |
commit | 9ca70fb2e5423ccb132ddbb926a04659b7015bfc (patch) | |
tree | 00936931e4e24a93b964f40c6190bb5cde7d4084 /emscripten.py | |
parent | d0b3bb756d24c8ddea9f7de0225730eea46fa928 (diff) |
refactor dynCall return
Diffstat (limited to 'emscripten.py')
-rwxr-xr-x | emscripten.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/emscripten.py b/emscripten.py index f3683a96..fcbbcc36 100755 --- a/emscripten.py +++ b/emscripten.py @@ -339,13 +339,15 @@ var i64Math_modulo = function(a, b, c, d, e) { i64Math.modulo(a, b, c, d, e) }; for sig in last_forwarded_json['Functions']['tables'].iterkeys(): args = ','.join(['a' + str(i) for i in range(1, len(sig))]) arg_coercions = ' '.join(['a' + str(i) + '=' + asm_coerce('a' + str(i), sig[i]) + ';' for i in range(1, len(sig))]) + coerced_args = ','.join([asm_coerce('a' + str(i), sig[i]) for i in range(1, len(sig))]) + ret = '%sFUNCTION_TABLE_%s[index&{{{ FTM_%s }}}](%s);' % ('return ' if sig[0] != 'v' else '', sig, sig, coerced_args) function_tables_impls.append(''' function dynCall_%s(index%s%s) { index = index|0; %s - %sFUNCTION_TABLE_%s[index&{{{ FTM_%s }}}](%s); + %s } -''' % (sig, ',' if len(sig) > 1 else '', args, arg_coercions, 'return ' if sig[0] != 'v' else '', sig, sig, args)) +''' % (sig, ',' if len(sig) > 1 else '', args, arg_coercions, ret)) # calculate exports exported_implemented_functions = list(exported_implemented_functions) exports = [] |