Skip to content

Commit a221018

Browse files
committed
comments updated
1 parent 6fe8acb commit a221018

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/compiler/checker.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,9 +2049,10 @@ module ts {
20492049
return <ObjectType>type;
20502050
}
20512051

2052+
// arrayType argument is used as a backup in case if globalArrayType is not defined
20522053
function createArrayType(elementType: Type, arrayType?: ObjectType): Type {
2053-
var type = globalArrayType || arrayType;
2054-
return type !== emptyObjectType ? createTypeReference(<GenericType>type, [elementType]) : emptyObjectType;
2054+
var rootType = globalArrayType || arrayType;
2055+
return rootType !== emptyObjectType ? createTypeReference(<GenericType>rootType, [elementType]) : emptyObjectType;
20552056
}
20562057

20572058
function getTypeFromArrayTypeNode(node: ArrayTypeNode): Type {
@@ -2062,7 +2063,9 @@ module ts {
20622063
// if user code contains augmentation for Array type that includes call\construct signatures with arrays as parameter\return types,
20632064
// then we might step here then during initialization of the global Array type when globalArrayType is not yet set.
20642065
// CODE: interface Array<T> { (): number[] }
2065-
// in this case just resolve name 'Array' again and get declared type of symbol
2066+
// in this case just resolve name 'Array' again and get declared type of symbol.
2067+
// this type is the one that eventually should be set as 'globalArrayType'.
2068+
// NOTE: this is specific to signatures since got signatures we realize parameter\return types.
20662069
var arrayTypeSymbol = resolveName(node, "Array", SymbolFlags.Type, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
20672070
Debug.assert(arrayTypeSymbol);
20682071
arrayType = getDeclaredTypeOfSymbol(arrayTypeSymbol);

0 commit comments

Comments
 (0)