(accept)
| 47787 | function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getConstraintOfTypeParameter, getFirstIdentifier, getTypeArguments) { |
| 47788 | return getSymbolWalker; |
| 47789 | function getSymbolWalker(accept) { |
| 47790 | if (accept === void 0) { accept = function () { return true; }; } |
| 47791 | var visitedTypes = []; // Sparse array from id to type |
| 47792 | var visitedSymbols = []; // Sparse array from id to symbol |
| 47793 | return { |
| 47794 | walkType: function (type) { |
| 47795 | try { |
| 47796 | visitType(type); |
| 47797 | return { visitedTypes: ts.getOwnValues(visitedTypes), visitedSymbols: ts.getOwnValues(visitedSymbols) }; |
| 47798 | } |
| 47799 | finally { |
| 47800 | ts.clear(visitedTypes); |
| 47801 | ts.clear(visitedSymbols); |
| 47802 | } |
| 47803 | }, |
| 47804 | walkSymbol: function (symbol) { |
| 47805 | try { |
| 47806 | visitSymbol(symbol); |
| 47807 | return { visitedTypes: ts.getOwnValues(visitedTypes), visitedSymbols: ts.getOwnValues(visitedSymbols) }; |
| 47808 | } |
| 47809 | finally { |
| 47810 | ts.clear(visitedTypes); |
| 47811 | ts.clear(visitedSymbols); |
| 47812 | } |
| 47813 | }, |
| 47814 | }; |
| 47815 | function visitType(type) { |
| 47816 | if (!type) { |
| 47817 | return; |
| 47818 | } |
| 47819 | if (visitedTypes[type.id]) { |
| 47820 | return; |
| 47821 | } |
| 47822 | visitedTypes[type.id] = type; |
| 47823 | // Reuse visitSymbol to visit the type's symbol, |
| 47824 | // but be sure to bail on recuring into the type if accept declines the symbol. |
| 47825 | var shouldBail = visitSymbol(type.symbol); |
| 47826 | if (shouldBail) |
| 47827 | return; |
| 47828 | // Visit the type's related types, if any |
| 47829 | if (type.flags & 524288 /* TypeFlags.Object */) { |
| 47830 | var objectType = type; |
| 47831 | var objectFlags = objectType.objectFlags; |
| 47832 | if (objectFlags & 4 /* ObjectFlags.Reference */) { |
| 47833 | visitTypeReference(type); |
| 47834 | } |
| 47835 | if (objectFlags & 32 /* ObjectFlags.Mapped */) { |
| 47836 | visitMappedType(type); |
| 47837 | } |
| 47838 | if (objectFlags & (1 /* ObjectFlags.Class */ | 2 /* ObjectFlags.Interface */)) { |
| 47839 | visitInterfaceType(type); |
| 47840 | } |
| 47841 | if (objectFlags & (8 /* ObjectFlags.Tuple */ | 16 /* ObjectFlags.Anonymous */)) { |
| 47842 | visitObjectType(objectType); |
| 47843 | } |
| 47844 | } |
| 47845 | if (type.flags & 262144 /* TypeFlags.TypeParameter */) { |
| 47846 | visitTypeParameter(type); |
nothing calls this directly
no test coverage detected