(symbol, dependent)
| 556 | } |
| 557 | |
| 558 | function addFromLibrary(symbol, dependent) { |
| 559 | // don't process any special identifiers. These are looked up when |
| 560 | // processing the base name of the identifier. |
| 561 | if (isDecorator(symbol)) { |
| 562 | return; |
| 563 | } |
| 564 | |
| 565 | // if the function was implemented in compiled code, there is no need to |
| 566 | // include the js version |
| 567 | if (WASM_EXPORTS.has(symbol)) { |
| 568 | return; |
| 569 | } |
| 570 | |
| 571 | if (symbol in addedLibraryItems) { |
| 572 | return; |
| 573 | } |
| 574 | addedLibraryItems[symbol] = true; |
| 575 | |
| 576 | const deps = LibraryManager.library[symbol + '__deps'] ??= []; |
| 577 | let sig = LibraryManager.library[symbol + '__sig']; |
| 578 | if (!WASM_BIGINT && sig && sig[0] == 'j') { |
| 579 | // Without WASM_BIGINT functions that return i64 depend on setTempRet0 |
| 580 | // to return the upper 32-bits of the result. |
| 581 | // See makeReturn64 in parseTools.py. |
| 582 | deps.push('setTempRet0'); |
| 583 | } |
| 584 | |
| 585 | const isAsyncFunction = LibraryManager.library[symbol + '__async']; |
| 586 | if (ASYNCIFY && isAsyncFunction) { |
| 587 | asyncFuncs.push(symbol); |
| 588 | } |
| 589 | |
| 590 | if (symbolsOnly) { |
| 591 | if (LibraryManager.library.hasOwnProperty(symbol)) { |
| 592 | // Resolve aliases before looking up deps |
| 593 | var transitiveDeps = getTransitiveDeps(symbol); |
| 594 | symbolDeps[symbol] = transitiveDeps.filter( |
| 595 | (d) => !isJsOnlySymbol(d) && !(d in LibraryManager.library), |
| 596 | ); |
| 597 | } |
| 598 | return; |
| 599 | } |
| 600 | |
| 601 | // This gets set to true in the case of dynamic linking for symbols that |
| 602 | // are undefined in the main module. In this case we create a stub that |
| 603 | // will resolve the correct symbol at runtime, or assert if its missing. |
| 604 | let isStub = false; |
| 605 | |
| 606 | const mangled = mangleCSymbolName(symbol); |
| 607 | |
| 608 | if (!LibraryManager.library.hasOwnProperty(symbol)) { |
| 609 | const isWeakImport = WEAK_IMPORTS.has(symbol); |
| 610 | if (!isDefined(symbol) && !isWeakImport) { |
| 611 | if (PROXY_TO_PTHREAD && !MAIN_MODULE && symbol == '__main_argc_argv') { |
| 612 | error('PROXY_TO_PTHREAD proxies main() for you, but no main exists'); |
| 613 | return; |
| 614 | } |
| 615 | let undefinedSym = symbol; |
no test coverage detected