Merge pull request #7163 from Microsoft/cachePairs

do not make inferences with the same source\target pair multiple times
This commit is contained in:
Vladimir Matveev
2016-02-22 11:50:52 -08:00
2 changed files with 8 additions and 1 deletions

View File

@@ -6524,6 +6524,7 @@ namespace ts {
let targetStack: Type[];
let depth = 0;
let inferiority = 0;
const visited: Map<boolean> = {};
inferFromTypes(source, target);
function isInProcess(source: Type, target: Type) {
@@ -6653,6 +6654,12 @@ namespace ts {
return;
}
const key = source.id + "," + target.id;
if (hasProperty(visited, key)) {
return;
}
visited[key] = true;
if (depth === 0) {
sourceStack = [];
targetStack = [];

View File

@@ -469,7 +469,7 @@ declare namespace ts.server.protocol {
placeOpenBraceOnNewLineForControlBlocks?: boolean;
/** Index operator */
[key: string]: string | number | boolean;
[key: string]: string | number | boolean;
}
/**