Skip to content

Commit

Permalink
Cleanup make_invoke python helper. NFC (#16232)
Browse files Browse the repository at this point in the history
Use correct indentation and remove unused param.
  • Loading branch information
sbc100 authored Feb 10, 2022
1 parent 3740492 commit 6262af1
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions tools/js_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def make_dynCall(sig, args):
return 'getWasmTableEntry(%s)(%s)' % (args[0], ','.join(args[1:]))


def make_invoke(sig, named=True):
def make_invoke(sig):
legal_sig = legalize_sig(sig) # TODO: do this in extcall, jscall?
args = ['index'] + ['a' + str(i) for i in range(1, len(legal_sig))]
ret = 'return ' if sig[0] != 'v' else ''
Expand All @@ -122,17 +122,16 @@ def make_invoke(sig, named=True):
else:
rethrow = "if (e !== e+0) throw e;"

name = (' invoke_' + sig) if named else ''
ret = '''\
function%s(%s) {
var sp = stackSave();
try {
%s
} catch(e) {
stackRestore(sp);
%s
_setThrew(1, 0);
}
}''' % (name, ','.join(args), body, rethrow)
function invoke_%s(%s) {
var sp = stackSave();
try {
%s
} catch(e) {
stackRestore(sp);
%s
_setThrew(1, 0);
}
}''' % (sig, ','.join(args), body, rethrow)

return ret

0 comments on commit 6262af1

Please sign in to comment.