Skip to content

Commit

Permalink
Use getRootSymbols for all union property needs
Browse files Browse the repository at this point in the history
  • Loading branch information
mhegazy committed Oct 9, 2014
1 parent 779db6e commit 2eb51ab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
5 changes: 0 additions & 5 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ module ts {
getFullyQualifiedName: getFullyQualifiedName,
getResolvedSignature: getResolvedSignature,
getEnumMemberValue: getEnumMemberValue,
getUnionTypesOfUnionProperty: getUnionTypesOfUnionProperty
};

var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
Expand Down Expand Up @@ -1751,10 +1750,6 @@ module ts {
return links.type;
}

function getUnionTypesOfUnionProperty(symbol: Symbol): Type[] {
return (symbol.flags & SymbolFlags.UnionProperty) ? getSymbolLinks(symbol).unionType.types : undefined;
}

function getTypeOfSymbol(symbol: Symbol): Type {
if (symbol.flags & (SymbolFlags.Variable | SymbolFlags.Property)) {
return getTypeOfVariableOrParameterOrProperty(symbol);
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,6 @@ module ts {
getContextualType(node: Node): Type;
getResolvedSignature(node: CallExpression, candidatesOutArray?: Signature[]): Signature;

getUnionTypesOfUnionProperty(symbol: Symbol): Type[];

// Returns the constant value of this enum member, or 'undefined' if the enum member has a
// computed value.
getEnumMemberValue(node: EnumMember): number;
Expand Down
8 changes: 4 additions & 4 deletions src/services/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2619,8 +2619,8 @@ module ts {
var result: DefinitionInfo[] = [];

if (symbol.flags & SymbolFlags.UnionProperty) {
forEach(typeInfoResolver.getUnionTypesOfUnionProperty(symbol), t => {
getDefinitionFromSymbol(typeInfoResolver.getPropertyOfType(t, symbol.name), node, result);
forEach(typeInfoResolver.getRootSymbols(symbol), s => {
getDefinitionFromSymbol(s, node, result);
});
}
else {
Expand Down Expand Up @@ -3013,8 +3013,8 @@ module ts {
// Handel union properties

This comment has been minimized.

Copy link
@DanielRosenwasser

DanielRosenwasser Oct 10, 2014

Member

Correct to "Handle"

if (symbol.flags & SymbolFlags.UnionProperty) {
declarations = [];
forEach(typeInfoResolver.getUnionTypesOfUnionProperty(symbol), t => {
declarations.push.apply(declarations, t.getProperty(symbol.name).declarations);
forEach(typeInfoResolver.getRootSymbols(symbol), s => {
declarations.push.apply(declarations, s.declarations);
});
}

Expand Down

0 comments on commit 2eb51ab

Please sign in to comment.