mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-12 20:01:02 -05:00
Merge pull request #1586 from Microsoft/copymap
extract map copying logic to a separate function
This commit is contained in:
@@ -3652,9 +3652,7 @@ module ts {
|
||||
var maybeCache = maybeStack[depth];
|
||||
// If result is definitely true, copy assumptions to global cache, else copy to next level up
|
||||
var destinationCache = result === Ternary.True || depth === 0 ? relation : maybeStack[depth - 1];
|
||||
for (var p in maybeCache) {
|
||||
destinationCache[p] = maybeCache[p];
|
||||
}
|
||||
copyMap(/*source*/maybeCache, /*target*/destinationCache);
|
||||
}
|
||||
else {
|
||||
// A false result goes straight into global cache (when something is false under assumptions it
|
||||
|
||||
@@ -208,6 +208,12 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function copyMap<T>(source: Map<T>, target: Map<T>): void {
|
||||
for (var p in source) {
|
||||
target[p] = source[p];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a map from the elements of an array.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user