Skip to content

Commit 53d7b92

Browse files
authored
Remove redundant variable. NFC (#21705)
I had a runtime error in another PR I'm working on where one of the imports was undefined. Accessing this `sig` property should inside the `typeof` check. Also since its only really ever accessed ones (aside from the assertion) I decided to just remove the extra variable.
1 parent 5e9ed03 commit 53d7b92

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/library_async.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,15 @@ addToLibrary({
4747
var importPattern = {{{ new RegExp(`^(${ASYNCIFY_IMPORTS_EXCEPT_JS_LIBS.map(x => x.split('.')[1]).join('|').replace(/\*/g, '.*')})$`) }}};
4848

4949
for (let [x, original] of Object.entries(imports)) {
50-
let sig = original.sig;
5150
if (typeof original == 'function') {
5251
let isAsyncifyImport = original.isAsync || importPattern.test(x);
5352
#if ASYNCIFY == 2
5453
// Wrap async imports with a suspending WebAssembly function.
5554
if (isAsyncifyImport) {
5655
#if ASSERTIONS
57-
assert(sig, `Missing __sig for ${x}`);
56+
assert(original.sig, `Missing __sig for ${x}`);
5857
#endif
59-
let type = sigToWasmTypes(sig);
58+
let type = sigToWasmTypes(original.sig);
6059
#if ASYNCIFY_DEBUG
6160
dbg('asyncify: suspendOnReturnedPromise for', x, original);
6261
#endif
@@ -100,7 +99,7 @@ addToLibrary({
10099
// The dynamic library loader needs to be able to read .sig
101100
// properties, so that it knows function signatures when it adds
102101
// them to the table.
103-
imports[x].sig = sig;
102+
imports[x].sig = original.sig;
104103
#endif // MAIN_MODULE
105104
#endif // ASSERTIONS
106105
}

0 commit comments

Comments
 (0)