public void process(@NotNull BodiesResolveContext bodiesResolveContext) { for (JetFile file : bodiesResolveContext.getFiles()) { checkDeclarationContainer(file); } for (JetClass aClass : bodiesResolveContext.getClasses().keySet()) { if (!bodiesResolveContext.completeAnalysisNeeded(aClass)) continue; checkDeclarationContainer(aClass); } for (JetObjectDeclaration objectDeclaration : bodiesResolveContext.getObjects().keySet()) { if (!bodiesResolveContext.completeAnalysisNeeded(objectDeclaration)) continue; checkDeclarationContainer(objectDeclaration); } for (Map.Entry<JetNamedFunction, SimpleFunctionDescriptor> entry : bodiesResolveContext.getFunctions().entrySet()) { JetNamedFunction function = entry.getKey(); SimpleFunctionDescriptor functionDescriptor = entry.getValue(); if (!bodiesResolveContext.completeAnalysisNeeded(function)) continue; final JetType expectedReturnType = !function.hasBlockBody() && !function.hasDeclaredReturnType() ? NO_EXPECTED_TYPE : functionDescriptor.getReturnType(); checkFunction(function, expectedReturnType); } for (Map.Entry<JetProperty, PropertyDescriptor> entry : bodiesResolveContext.getProperties().entrySet()) { JetProperty property = entry.getKey(); if (!bodiesResolveContext.completeAnalysisNeeded(property)) continue; PropertyDescriptor propertyDescriptor = entry.getValue(); checkProperty(property, propertyDescriptor); } }
private void checkProperty(JetProperty property, PropertyDescriptor propertyDescriptor) { for (JetPropertyAccessor accessor : property.getAccessors()) { PropertyAccessorDescriptor accessorDescriptor = accessor.isGetter() ? propertyDescriptor.getGetter() : propertyDescriptor.getSetter(); assert accessorDescriptor != null; checkFunction(accessor, accessorDescriptor.getReturnType()); } }