mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Basic implementation for finding all references
This commit is contained in:
@@ -110,7 +110,8 @@ module ts {
|
||||
getAliasedSymbol: resolveImport,
|
||||
isUndefinedSymbol: symbol => symbol === undefinedSymbol,
|
||||
isArgumentsSymbol: symbol => symbol === argumentsSymbol,
|
||||
hasEarlyErrors: hasEarlyErrors
|
||||
hasEarlyErrors: hasEarlyErrors,
|
||||
resolveEntityNameForShortHandPropertyAssignment: resolveEntityNameForShortHandPropertyAssignment,
|
||||
};
|
||||
|
||||
var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
|
||||
@@ -537,6 +538,10 @@ module ts {
|
||||
return symbol.flags & meaning ? symbol : resolveImport(symbol);
|
||||
}
|
||||
|
||||
function resolveEntityNameForShortHandPropertyAssignment(location: Node): Symbol {
|
||||
return resolveEntityName(location, <Identifier>location, SymbolFlags.Value);
|
||||
}
|
||||
|
||||
function isExternalModuleNameRelative(moduleName: string): boolean {
|
||||
// TypeScript 1.0 spec (April 2014): 11.2.1
|
||||
// An external module name is "relative" if the first term is "." or "..".
|
||||
|
||||
@@ -733,6 +733,7 @@ module ts {
|
||||
getEnumMemberValue(node: EnumMember): number;
|
||||
isValidPropertyAccess(node: PropertyAccess, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
resolveEntityNameForShortHandPropertyAssignment(location: Node): Symbol;
|
||||
}
|
||||
|
||||
export interface SymbolDisplayBuilder {
|
||||
|
||||
@@ -4227,6 +4227,9 @@ module ts {
|
||||
forEach(getPropertySymbolsFromContextualType(location), contextualSymbol => {
|
||||
result.push.apply(result, typeInfoResolver.getRootSymbols(contextualSymbol));
|
||||
});
|
||||
if (location.kind === SyntaxKind.Identifier && location.parent.kind === SyntaxKind.ShortHandPropertyAssignment) {
|
||||
result.push(typeInfoResolver.resolveEntityNameForShortHandPropertyAssignment(location));
|
||||
}
|
||||
}
|
||||
|
||||
// If this is a union property, add all the symbols from all its source symbols in all unioned types.
|
||||
|
||||
Reference in New Issue
Block a user