Made a getThisContainer function.
This commit is contained in:
parent
a6a6d77d4a
commit
84e385ddfa
2 changed files with 10 additions and 8 deletions
|
@ -430,6 +430,14 @@ module ts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getThisContainer(node: Node): Node {
|
||||||
|
do {
|
||||||
|
node = getThisContainerOrArrowFunction(node);
|
||||||
|
} while (node.kind === SyntaxKind.ArrowFunction);
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
export function hasRestParameters(s: SignatureDeclaration): boolean {
|
export function hasRestParameters(s: SignatureDeclaration): boolean {
|
||||||
return s.parameters.length > 0 && (s.parameters[s.parameters.length - 1].flags & NodeFlags.Rest) !== 0;
|
return s.parameters.length > 0 && (s.parameters[s.parameters.length - 1].flags & NodeFlags.Rest) !== 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2629,10 +2629,7 @@ module ts {
|
||||||
|
|
||||||
function getReferencesForThisKeyword(thisKeyword: Node, sourceFiles: SourceFile[]) {
|
function getReferencesForThisKeyword(thisKeyword: Node, sourceFiles: SourceFile[]) {
|
||||||
// Get the owner" of the 'this' keyword.
|
// Get the owner" of the 'this' keyword.
|
||||||
var thisContainer = thisKeyword;
|
var thisContainer = getThisContainer(thisKeyword);
|
||||||
do {
|
|
||||||
thisContainer = getThisContainerOrArrowFunction(thisContainer);
|
|
||||||
} while (thisContainer.kind === SyntaxKind.ArrowFunction);
|
|
||||||
|
|
||||||
var searchSpaceNode: Node;
|
var searchSpaceNode: Node;
|
||||||
|
|
||||||
|
@ -2683,10 +2680,7 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the owner" of the 'this' keyword.
|
// Get the owner" of the 'this' keyword.
|
||||||
var container = node;
|
var container = getThisContainer(node);
|
||||||
do {
|
|
||||||
container = getThisContainerOrArrowFunction(container);
|
|
||||||
} while (container.kind === SyntaxKind.ArrowFunction);
|
|
||||||
|
|
||||||
switch (container.kind) {
|
switch (container.kind) {
|
||||||
case SyntaxKind.Property:
|
case SyntaxKind.Property:
|
||||||
|
|
Loading…
Reference in a new issue