Skip to content

Commit 3635871

Browse files
committed
extract map copying logic to a separate function
1 parent 4e5a3ae commit 3635871

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3651,9 +3651,7 @@ module ts {
36513651
var maybeCache = maybeStack[depth];
36523652
// If result is definitely true, copy assumptions to global cache, else copy to next level up
36533653
var destinationCache = result === Ternary.True || depth === 0 ? relation : maybeStack[depth - 1];
3654-
for (var p in maybeCache) {
3655-
destinationCache[p] = maybeCache[p];
3656-
}
3654+
copyMap(maybeCache, destinationCache);
36573655
}
36583656
else {
36593657
// A false result goes straight into global cache (when something is false under assumptions it

src/compiler/core.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ module ts {
208208
return result;
209209
}
210210

211+
export function copyMap<T>(source: Map<T>, target: Map<T>): void {
212+
for (var p in source) {
213+
target[p] = source[p];
214+
}
215+
}
216+
211217
/**
212218
* Creates a map from the elements of an array.
213219
*

0 commit comments

Comments
 (0)