-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support symbol kind for union properties
- Loading branch information
Showing
4 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2284,8 +2284,16 @@ module ts { | |
} | ||
} | ||
|
||
function getConcreteSymbol(symbol: Symbol): Symbol { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
if (symbol.flags & SymbolFlags.UnionProperty) { | ||
var types = typeInfoResolver.getUnionTypesOfUnionProperty(symbol); | ||
symbol = typeInfoResolver.getPropertyOfType(types[0], symbol.name); | ||
This comment has been minimized.
Sorry, something went wrong.
DanielRosenwasser
Member
|
||
} | ||
return typeInfoResolver.getRootSymbol(symbol); | ||
} | ||
|
||
function getSymbolKind(symbol: Symbol): string { | ||
var flags = typeInfoResolver.getRootSymbol(symbol).getFlags(); | ||
var flags = getConcreteSymbol(symbol).getFlags(); | ||
|
||
if (flags & SymbolFlags.Module) return ScriptElementKind.moduleElement; | ||
if (flags & SymbolFlags.Class) return ScriptElementKind.classElement; | ||
|
@@ -2344,6 +2352,7 @@ module ts { | |
} | ||
|
||
function getSymbolModifiers(symbol: Symbol): string { | ||
symbol = getConcreteSymbol(symbol); | ||
return symbol && symbol.declarations && symbol.declarations.length > 0 | ||
? getNodeModifiers(symbol.declarations[0]) | ||
: ScriptElementKindModifier.none; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
///<reference path="fourslash.ts" /> | ||
|
||
////interface One { | ||
//// commonProperty: number; | ||
//// commonFunction(): number; | ||
////} | ||
//// | ||
////interface Two { | ||
//// commonProperty: string | ||
//// commonFunction(): number; | ||
////} | ||
//// | ||
////var x : One | Two; | ||
//// | ||
////x./**/ | ||
|
||
goTo.marker(); | ||
verify.memberListContains("commonProperty", "string | number", undefined, undefined, "property"); | ||
verify.memberListContains("commonFunction", "() => number", undefined, undefined, "method"); | ||
verify.memberListCount(2); |
Please document what this does. This is a vague name when offhandedly reading it.