mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Filter protected members from the completion list
This commit is contained in:
+21
-1
@@ -92,7 +92,8 @@ module ts {
|
||||
getContextualType: getContextualType,
|
||||
getFullyQualifiedName: getFullyQualifiedName,
|
||||
getResolvedSignature: getResolvedSignature,
|
||||
getEnumMemberValue: getEnumMemberValue
|
||||
getEnumMemberValue: getEnumMemberValue,
|
||||
isValidPropertyAccess: isValidPropertyAccess
|
||||
};
|
||||
|
||||
var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
|
||||
@@ -4239,6 +4240,25 @@ module ts {
|
||||
return anyType;
|
||||
}
|
||||
|
||||
function isValidPropertyAccess(node: PropertyAccess, propertyName: string): boolean {
|
||||
var type = checkExpression(node.left);
|
||||
if (type !== unknownType && type !== anyType) {
|
||||
var apparentType = getApparentType(getWidenedType(type));
|
||||
var prop = getPropertyOfApparentType(apparentType, propertyName);
|
||||
if (prop && prop.parent && prop.parent.flags & SymbolFlags.Class) {
|
||||
if (node.left.kind === SyntaxKind.SuperKeyword && getDeclarationKindFromSymbol(prop) !== SyntaxKind.Method) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
var diagnosticsCount = diagnostics.length;
|
||||
checkClassPropertyAccess(node, type, prop);
|
||||
return diagnostics.length === diagnosticsCount
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function checkIndexedAccess(node: IndexedAccess): Type {
|
||||
var objectType = checkExpression(node.object);
|
||||
var indexType = checkExpression(node.index);
|
||||
|
||||
@@ -655,6 +655,8 @@ module ts {
|
||||
// Returns the constant value of this enum member, or 'undefined' if the enum member has a
|
||||
// computed value.
|
||||
getEnumMemberValue(node: EnumMember): number;
|
||||
|
||||
isValidPropertyAccess(node: PropertyAccess, propertyName: string): boolean;
|
||||
}
|
||||
|
||||
export interface TextWriter {
|
||||
|
||||
Reference in New Issue
Block a user