Merge pull request #3846 from DickvdBrink/abstract-occurrences

Highlight Abstract occurrences
This commit is contained in:
Daniel Rosenwasser
2015-07-13 17:08:14 -07:00
3 changed files with 70 additions and 1 deletions

View File

@@ -4696,6 +4696,11 @@ namespace ts {
return undefined;
}
}
else if (modifier === SyntaxKind.AbstractKeyword) {
if (!(container.kind === SyntaxKind.ClassDeclaration || declaration.kind === SyntaxKind.ClassDeclaration)) {
return undefined;
}
}
else {
// unsupported modifier
return undefined;
@@ -4708,7 +4713,13 @@ namespace ts {
switch (container.kind) {
case SyntaxKind.ModuleBlock:
case SyntaxKind.SourceFile:
nodes = (<Block>container).statements;
// Container is either a class declaration or the declaration is a classDeclaration
if (modifierFlag & NodeFlags.Abstract) {
nodes = (<Node[]>(<ClassDeclaration>declaration).members).concat(declaration);
}
else {
nodes = (<Block>container).statements;
}
break;
case SyntaxKind.Constructor:
nodes = (<Node[]>(<ConstructorDeclaration>container).parameters).concat(
@@ -4728,6 +4739,9 @@ namespace ts {
nodes = nodes.concat(constructor.parameters);
}
}
else if (modifierFlag & NodeFlags.Abstract) {
nodes = nodes.concat(container);
}
break;
default:
Debug.fail("Invalid container kind.")
@@ -4755,6 +4769,8 @@ namespace ts {
return NodeFlags.Export;
case SyntaxKind.DeclareKeyword:
return NodeFlags.Ambient;
case SyntaxKind.AbstractKeyword:
return NodeFlags.Abstract;
default:
Debug.fail();
}