* Returns set of used exports, or true (when namespace object is used), or false (when unused), or null (when unknown). * @param {RuntimeSpec} runtime the runtime * @returns {SortableSet<ExportInfoName> | boolean | null} set of used exports, or true (when namespace object is used), or false (whe
(runtime)
| 587 | * @returns {SortableSet<ExportInfoName> | boolean | null} set of used exports, or true (when namespace object is used), or false (when unused), or null (when unknown) |
| 588 | */ |
| 589 | getUsedExports(runtime) { |
| 590 | switch (this._otherExportsInfo.getUsed(runtime)) { |
| 591 | case UsageState.NoInfo: |
| 592 | return null; |
| 593 | case UsageState.Unknown: |
| 594 | case UsageState.OnlyPropertiesUsed: |
| 595 | case UsageState.Used: |
| 596 | return true; |
| 597 | } |
| 598 | |
| 599 | /** @type {ExportInfoName[]} */ |
| 600 | const array = []; |
| 601 | if (!this._exportsAreOrdered) this._sortExports(); |
| 602 | for (const exportInfo of this._exports.values()) { |
| 603 | switch (exportInfo.getUsed(runtime)) { |
| 604 | case UsageState.NoInfo: |
| 605 | return null; |
| 606 | case UsageState.Unknown: |
| 607 | return true; |
| 608 | case UsageState.OnlyPropertiesUsed: |
| 609 | case UsageState.Used: |
| 610 | array.push(exportInfo.name); |
| 611 | } |
| 612 | } |
| 613 | if (this._redirectTo !== undefined) { |
| 614 | const inner = this._redirectTo.getUsedExports(runtime); |
| 615 | if (inner === null) return null; |
| 616 | if (inner === true) return true; |
| 617 | if (inner !== false) { |
| 618 | for (const item of inner) { |
| 619 | array.push(item); |
| 620 | } |
| 621 | } |
| 622 | } |
| 623 | if (array.length === 0) { |
| 624 | switch (this._sideEffectsOnlyInfo.getUsed(runtime)) { |
| 625 | case UsageState.NoInfo: |
| 626 | return null; |
| 627 | case UsageState.Unused: |
| 628 | return false; |
| 629 | } |
| 630 | } |
| 631 | return /** @type {SortableSet<ExportInfoName>} */ (new SortableSet(array)); |
| 632 | } |
| 633 | |
| 634 | /** |
| 635 | * Gets provided exports. |
nothing calls this directly
no test coverage detected