resolvedJSDocType should cache on node, not symbol (#36561)

This commit is contained in:
Nathan Shively-Sanders 2020-01-31 15:19:45 -08:00 committed by GitHub
parent 86556d6c03
commit ad249043da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

@ -163,7 +163,6 @@ namespace ts {
ResolvedReturnType,
ImmediateBaseConstraint,
EnumTagType,
JSDocTypeReference,
ResolvedTypeArguments,
}
@ -6920,8 +6919,6 @@ namespace ts {
return !!(<Signature>target).resolvedReturnType;
case TypeSystemPropertyName.ImmediateBaseConstraint:
return !!(<Type>target).immediateBaseConstraint;
case TypeSystemPropertyName.JSDocTypeReference:
return !!getSymbolLinks(target as Symbol).resolvedJSDocType;
case TypeSystemPropertyName.ResolvedTypeArguments:
return !!(target as TypeReference).resolvedTypeArguments;
}
@ -11184,7 +11181,7 @@ namespace ts {
* but this function's special-case code fakes alias resolution as well.
*/
function getTypeFromJSDocValueReference(node: NodeWithTypeArguments, symbol: Symbol): Type | undefined {
const links = getSymbolLinks(symbol);
const links = getNodeLinks(node);
if (!links.resolvedJSDocType) {
const valueType = getTypeOfSymbol(symbol);
let typeType = valueType;

View File

@ -4063,7 +4063,6 @@ namespace ts {
nameType?: Type; // Type associated with a late-bound symbol
uniqueESSymbolType?: Type; // UniqueESSymbol type for a symbol
declaredType?: Type; // Type of class, interface, enum, type alias, or type parameter
resolvedJSDocType?: Type; // Resolved type of a JSDoc type reference
typeParameters?: TypeParameter[]; // Type parameters of type alias (undefined if non-generic)
outerTypeParameters?: TypeParameter[]; // Outer type parameters of anonymous object type
instantiations?: Map<Type>; // Instantiations of generic type alias (undefined if non-generic)
@ -4239,6 +4238,7 @@ namespace ts {
jsxFlags: JsxFlags; // flags for knowing what kind of element/attributes we're dealing with
resolvedJsxElementAttributesType?: Type; // resolved element attributes type of a JSX openinglike element
resolvedJsxElementAllAttributesType?: Type; // resolved all element attributes type of a JSX openinglike element
resolvedJSDocType?: Type; // Resolved type of a JSDoc type reference
hasSuperCall?: boolean; // recorded result when we try to find super-call. We only try to find one if this flag is undefined, indicating that we haven't made an attempt.
superCall?: SuperCall; // Cached first super-call found in the constructor. Used in checking whether super is called before this-accessing
switchTypes?: Type[]; // Cached array of switch case expression types