PyHierarchyNodeDescriptor (@NotNull final PyClass cl) { PyHierarchyNodeDescriptor descriptor = null; final TypeEvalContext context = TypeEvalContext.codeAnalysis(cl.getProject(), cl.getContainingFile()); for (PyClass superClass : Lists.reverse(cl.getAncestorClasses(context))) { final PyHierarchyNodeDescriptor newDescriptor = new PyHierarchyNodeDescriptor(descriptor, superClass, false); if (descriptor != null) { descriptor.setCachedChildren(new PyHierarchyNodeDescriptor[]{newDescriptor}); } descriptor = newDescriptor; } final PyHierarchyNodeDescriptor newDescriptor = new PyHierarchyNodeDescriptor(descriptor, cl, true); if (descriptor != null) { descriptor.setCachedChildren(new HierarchyNodeDescriptor[]{newDescriptor}); } return newDescriptor; }