Merge pull request #15104 from Microsoft/covariantCallbacks

Covariant checking for callback parameters
This commit is contained in:
Anders Hejlsberg authored and GitHub committed 2017-04-18 11:35:21 -07:00
commit cef42c97fe
21 files changed
+727 -154

No files matched your search

+1 -1
View File
@@ -57,7 +57,7 @@ namespace ts {
// The visitXXX functions could be written as local functions that close over the cbNode and cbNodeArray
// callback parameters, but that causes a closure allocation for each invocation with noticeable effects
// on performance.
const visitNodes: (cb: (node: Node | Node[]) => T, nodes: Node[]) => T = cbNodeArray ? visitNodeArray : visitEachNode;
const visitNodes: (cb: ((node: Node) => T) | ((node: Node[]) => T), nodes: Node[]) => T = cbNodeArray ? visitNodeArray : visitEachNode;
const cbNodes = cbNodeArray || cbNode;
switch (node.kind) {
case SyntaxKind.QualifiedName: