(yieldType, returnType, nextType)
| 83092 | return iterationTypes && iterationTypes[getIterationTypesKeyFromIterationTypeKind(typeKind)]; |
| 83093 | } |
| 83094 | function createIterationTypes(yieldType, returnType, nextType) { |
| 83095 | // `yieldType` and `returnType` are defaulted to `neverType` they each will be combined |
| 83096 | // via `getUnionType` when merging iteration types. `nextType` is defined as `unknownType` |
| 83097 | // as it is combined via `getIntersectionType` when merging iteration types. |
| 83098 | if (yieldType === void 0) { yieldType = neverType; } |
| 83099 | if (returnType === void 0) { returnType = neverType; } |
| 83100 | if (nextType === void 0) { nextType = unknownType; } |
| 83101 | // Use the cache only for intrinsic types to keep it small as they are likely to be |
| 83102 | // more frequently created (i.e. `Iterator<number, void, unknown>`). Iteration types |
| 83103 | // are also cached on the type they are requested for, so we shouldn't need to maintain |
| 83104 | // the cache for less-frequently used types. |
| 83105 | if (yieldType.flags & 67359327 /* TypeFlags.Intrinsic */ && |
| 83106 | returnType.flags & (1 /* TypeFlags.Any */ | 131072 /* TypeFlags.Never */ | 2 /* TypeFlags.Unknown */ | 16384 /* TypeFlags.Void */ | 32768 /* TypeFlags.Undefined */) && |
| 83107 | nextType.flags & (1 /* TypeFlags.Any */ | 131072 /* TypeFlags.Never */ | 2 /* TypeFlags.Unknown */ | 16384 /* TypeFlags.Void */ | 32768 /* TypeFlags.Undefined */)) { |
| 83108 | var id = getTypeListId([yieldType, returnType, nextType]); |
| 83109 | var iterationTypes = iterationTypesCache.get(id); |
| 83110 | if (!iterationTypes) { |
| 83111 | iterationTypes = { yieldType: yieldType, returnType: returnType, nextType: nextType }; |
| 83112 | iterationTypesCache.set(id, iterationTypes); |
| 83113 | } |
| 83114 | return iterationTypes; |
| 83115 | } |
| 83116 | return { yieldType: yieldType, returnType: returnType, nextType: nextType }; |
| 83117 | } |
| 83118 | /** |
| 83119 | * Combines multiple `IterationTypes` records. |
| 83120 | * |
no test coverage detected
searching dependent graphs…