Addressing CR feedback
This commit is contained in:
parent
cd48b965f8
commit
782c55f771
2 changed files with 26 additions and 28 deletions
|
@ -2635,32 +2635,28 @@ module ts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDeclaredPropertiesOfClassOrInterface(type: InterfaceType): Symbol[] {
|
function resolveDeclaredMembers(type: InterfaceType): InterfaceTypeWithDeclaredMembers {
|
||||||
resolveDeclaredMembers(type);
|
if (!(<InterfaceTypeWithDeclaredMembers>type).declaredProperties) {
|
||||||
return type.declaredProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveDeclaredMembers(type: InterfaceType) {
|
|
||||||
if (!type.declaredProperties) {
|
|
||||||
var symbol = type.symbol;
|
var symbol = type.symbol;
|
||||||
type.declaredProperties = getNamedMembers(symbol.members);
|
(<InterfaceTypeWithDeclaredMembers>type).declaredProperties = getNamedMembers(symbol.members);
|
||||||
type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]);
|
(<InterfaceTypeWithDeclaredMembers>type).declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]);
|
||||||
type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]);
|
(<InterfaceTypeWithDeclaredMembers>type).declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]);
|
||||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String);
|
(<InterfaceTypeWithDeclaredMembers>type).declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String);
|
||||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number);
|
(<InterfaceTypeWithDeclaredMembers>type).declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number);
|
||||||
}
|
}
|
||||||
|
return <InterfaceTypeWithDeclaredMembers>type;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveClassOrInterfaceMembers(type: InterfaceType): void {
|
function resolveClassOrInterfaceMembers(type: InterfaceType): void {
|
||||||
resolveDeclaredMembers(type);
|
let target = resolveDeclaredMembers(type);
|
||||||
let members = type.symbol.members;
|
let members = target.symbol.members;
|
||||||
let callSignatures = type.declaredCallSignatures;
|
let callSignatures = target.declaredCallSignatures;
|
||||||
let constructSignatures = type.declaredConstructSignatures;
|
let constructSignatures = target.declaredConstructSignatures;
|
||||||
let stringIndexType = type.declaredStringIndexType;
|
let stringIndexType = target.declaredStringIndexType;
|
||||||
let numberIndexType = type.declaredNumberIndexType;
|
let numberIndexType = target.declaredNumberIndexType;
|
||||||
let baseTypes = getBaseTypes(type);
|
let baseTypes = getBaseTypes(target);
|
||||||
if (baseTypes.length) {
|
if (baseTypes.length) {
|
||||||
members = createSymbolTable(type.declaredProperties);
|
members = createSymbolTable(target.declaredProperties);
|
||||||
for (let baseType of baseTypes) {
|
for (let baseType of baseTypes) {
|
||||||
addInheritedMembers(members, getPropertiesOfObjectType(baseType));
|
addInheritedMembers(members, getPropertiesOfObjectType(baseType));
|
||||||
callSignatures = concatenate(callSignatures, getSignaturesOfType(baseType, SignatureKind.Call));
|
callSignatures = concatenate(callSignatures, getSignaturesOfType(baseType, SignatureKind.Call));
|
||||||
|
@ -2673,8 +2669,7 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveTypeReferenceMembers(type: TypeReference): void {
|
function resolveTypeReferenceMembers(type: TypeReference): void {
|
||||||
let target = type.target;
|
let target = resolveDeclaredMembers(type.target);
|
||||||
resolveDeclaredMembers(target);
|
|
||||||
let mapper = createTypeMapper(target.typeParameters, type.typeArguments);
|
let mapper = createTypeMapper(target.typeParameters, type.typeArguments);
|
||||||
let members = createInstantiatedSymbolTable(target.declaredProperties, mapper);
|
let members = createInstantiatedSymbolTable(target.declaredProperties, mapper);
|
||||||
let callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature);
|
let callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature);
|
||||||
|
@ -10139,7 +10134,7 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
let seen: Map<{ prop: Symbol; containingType: Type }> = {};
|
let seen: Map<{ prop: Symbol; containingType: Type }> = {};
|
||||||
forEach(getDeclaredPropertiesOfClassOrInterface(type), p => { seen[p.name] = { prop: p, containingType: type }; });
|
forEach(resolveDeclaredMembers(type).declaredProperties, p => { seen[p.name] = { prop: p, containingType: type }; });
|
||||||
let ok = true;
|
let ok = true;
|
||||||
|
|
||||||
for (let base of baseTypes) {
|
for (let base of baseTypes) {
|
||||||
|
|
|
@ -1485,17 +1485,20 @@ module ts {
|
||||||
// Class and interface types (TypeFlags.Class and TypeFlags.Interface)
|
// Class and interface types (TypeFlags.Class and TypeFlags.Interface)
|
||||||
export interface InterfaceType extends ObjectType {
|
export interface InterfaceType extends ObjectType {
|
||||||
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
|
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
|
||||||
declaredProperties: Symbol[]; // Declared members (computed by resolveDeclaredMembers)
|
|
||||||
declaredCallSignatures: Signature[]; // Declared call signatures (computed by resolveDeclaredMembers)
|
|
||||||
declaredConstructSignatures: Signature[]; // Declared construct signatures (computed by resolveDeclaredMembers)
|
|
||||||
declaredStringIndexType: Type; // Declared string index type (computed by resolveDeclaredMembers)
|
|
||||||
declaredNumberIndexType: Type; // Declared numeric index type (computed by resolveDeclaredMembers)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
export interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||||
baseTypes: ObjectType[];
|
baseTypes: ObjectType[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
|
||||||
|
declaredProperties: Symbol[]; // Declared members
|
||||||
|
declaredCallSignatures: Signature[]; // Declared call signatures
|
||||||
|
declaredConstructSignatures: Signature[]; // Declared construct signatures
|
||||||
|
declaredStringIndexType: Type; // Declared string index type
|
||||||
|
declaredNumberIndexType: Type; // Declared numeric index type
|
||||||
|
}
|
||||||
|
|
||||||
// Type references (TypeFlags.Reference)
|
// Type references (TypeFlags.Reference)
|
||||||
export interface TypeReference extends ObjectType {
|
export interface TypeReference extends ObjectType {
|
||||||
target: GenericType; // Type reference target
|
target: GenericType; // Type reference target
|
||||||
|
|
Loading…
Reference in a new issue