Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Arkhipov authored Dec 10, 2018
1 parent 9456d35 commit e534eae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Analysis/Engine/Impl/PythonAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,11 @@ internal AnalysisValue GetCached(object key, Func<AnalysisValue> maker) {

internal BuiltinInstanceInfo GetInstance(IPythonType type) => GetBuiltinType(type).Instance;

internal BuiltinClassInfo GetBuiltinType(IPythonType type) =>
(BuiltinClassInfo)GetCached(type,
() => MakeBuiltinType(type)
) ?? ClassInfos[BuiltinTypeId.Object];
internal BuiltinClassInfo GetBuiltinType(IPythonType type)
// Cached value may or may not be a class info. Previous calls to GetAnalysisValueFromObjects
// may have cached a different object for the type. For example, IPythonFunction would cache
// BuiltinFunctionInfo and not BuiltinClassInfo. Therefore, don't use direct cast.
=> GetCached(type, () => MakeBuiltinType(type)) as BuiltinClassInfo ?? MakeBuiltinType(type);

private BuiltinClassInfo MakeBuiltinType(IPythonType type) {
switch (type.TypeId) {
Expand Down

0 comments on commit e534eae

Please sign in to comment.