Merge pull request #799 from Microsoft/stopBlindlyColoring

Values sharing names with interfaces no longer classified as interfaces
This commit is contained in:
Daniel Rosenwasser
2014-10-01 17:42:15 -07:00
6 changed files with 117 additions and 97 deletions

View File

@@ -4044,7 +4044,7 @@ module ts {
return result;
function classifySymbol(symbol: Symbol) {
function classifySymbol(symbol: Symbol, isInTypePosition: boolean) {
var flags = symbol.getFlags();
if (flags & SymbolFlags.Class) {
@@ -4053,14 +4053,16 @@ module ts {
else if (flags & SymbolFlags.Enum) {
return ClassificationTypeNames.enumName;
}
else if (flags & SymbolFlags.Interface) {
return ClassificationTypeNames.interfaceName;
}
else if (flags & SymbolFlags.Module) {
return ClassificationTypeNames.moduleName;
}
else if (flags & SymbolFlags.TypeParameter) {
return ClassificationTypeNames.typeParameterName;
else if (isInTypePosition) {
if (flags & SymbolFlags.Interface) {
return ClassificationTypeNames.interfaceName;
}
else if (flags & SymbolFlags.TypeParameter) {
return ClassificationTypeNames.typeParameterName;
}
}
}
@@ -4070,7 +4072,7 @@ module ts {
if (node.kind === SyntaxKind.Identifier && node.getWidth() > 0) {
var symbol = typeInfoResolver.getSymbolInfo(node);
if (symbol) {
var type = classifySymbol(symbol);
var type = classifySymbol(symbol, isTypeNode(node) || isTypeDeclarationName(node));
if (type) {
result.push({
textSpan: new TypeScript.TextSpan(node.getStart(), node.getWidth()),