From 6262af1815ff60d65bab150f0e5a4267689ceaf3 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 10 Feb 2022 11:45:33 -0800 Subject: [PATCH] Cleanup make_invoke python helper. NFC (#16232) Use correct indentation and remove unused param. --- tools/js_manipulation.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tools/js_manipulation.py b/tools/js_manipulation.py index 8777ea3ec9b0b..3138f26151200 100644 --- a/tools/js_manipulation.py +++ b/tools/js_manipulation.py @@ -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 '' @@ -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