mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-29 19:42:39 -05:00
ensure unionProperty symbols have declarations set at creation time
This commit is contained in:
@@ -2144,6 +2144,14 @@ module ts {
|
||||
}
|
||||
var symbol = <TransientSymbol>createSymbol(SymbolFlags.UnionProperty | SymbolFlags.Transient, prop.name);
|
||||
symbol.unionType = type;
|
||||
|
||||
symbol.declarations = [];
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
var s = getPropertyOfType(types[i], prop.name);
|
||||
if (s.declarations)
|
||||
symbol.declarations.push.apply(symbol.declarations, s.declarations);
|
||||
}
|
||||
|
||||
members[prop.name] = symbol;
|
||||
});
|
||||
var callSignatures = getUnionSignatures(types, SignatureKind.Call);
|
||||
|
||||
@@ -2382,7 +2382,6 @@ module ts {
|
||||
}
|
||||
|
||||
function getSymbolModifiers(symbol: Symbol): string {
|
||||
symbol = typeInfoResolver.getRootSymbols(symbol)[0];
|
||||
return symbol && symbol.declarations && symbol.declarations.length > 0
|
||||
? getNodeModifiers(symbol.declarations[0])
|
||||
: ScriptElementKindModifier.none;
|
||||
@@ -2643,11 +2642,7 @@ module ts {
|
||||
|
||||
var result: DefinitionInfo[] = [];
|
||||
|
||||
// The symbol could be a unionProperty, we need to ensure we are collecting all
|
||||
// declarations, so use getRootSymbol first.
|
||||
forEach(typeInfoResolver.getRootSymbols(symbol), s => {
|
||||
getDefinitionFromSymbol(s, node, result);
|
||||
});
|
||||
getDefinitionFromSymbol(symbol, node, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -3162,13 +3157,7 @@ module ts {
|
||||
return [getReferenceEntryFromNode(node)];
|
||||
}
|
||||
|
||||
var declarations = symbol.getDeclarations();
|
||||
|
||||
// Handle union properties
|
||||
declarations = [];
|
||||
forEach(typeInfoResolver.getRootSymbols(symbol), s => {
|
||||
declarations.push.apply(declarations, s.declarations);
|
||||
});
|
||||
var declarations = symbol.declarations;
|
||||
|
||||
// The symbol was an internal symbol and does not have a declaration e.g.undefined symbol
|
||||
if (!declarations || !declarations.length) {
|
||||
|
||||
Reference in New Issue
Block a user