@NotNull public static Collection<FqName> getTopLevelFunctionFqNames( @NotNull Project project, @NotNull GlobalSearchScope scope, boolean shouldBeExtension) { Collection<FqName> result = Sets.newHashSet(); Collection<PsiClass> packageClasses = getClassesByAnnotation(KotlinPackage.class.getSimpleName(), project, scope); for (PsiClass psiClass : packageClasses) { String qualifiedName = psiClass.getQualifiedName(); if (qualifiedName == null) { continue; } FqName packageFqName = new FqName(qualifiedName).parent(); PackageData data = getPackageData(psiClass); if (data == null) { continue; } NameResolver nameResolver = data.getNameResolver(); for (ProtoBuf.Callable callable : data.getPackageProto().getMemberList()) { if (callable.hasReceiverType() == shouldBeExtension) { Name name = nameResolver.getName(callable.getName()); result.add(packageFqName.child(name)); } } } return result; }
public DeserializedSimpleFunctionDescriptor( @NotNull DeclarationDescriptor containingDeclaration, @NotNull ProtoBuf.Callable functionProto, @NotNull AnnotationDeserializer annotationDeserializer, @NotNull NameResolver nameResolver) { this( containingDeclaration, DescriptorDeserializer.getAnnotations( containingDeclaration, functionProto, functionProto.getFlags(), AnnotationDeserializer.AnnotatedCallableKind.FUNCTION, annotationDeserializer, nameResolver), nameResolver.getName(functionProto.getName()), DescriptorDeserializer.memberKind(Flags.MEMBER_KIND.get(functionProto.getFlags())), functionProto, nameResolver); }