Skip to content

Commit

Permalink
* Add getDeclarationsFromPackage to entry points in incremental docum…
Browse files Browse the repository at this point in the history
…ent.

* Reorganized getDeclarationsFromPackage implementation.
  • Loading branch information
neetopia committed Apr 7, 2021
1 parent 1d73c9f commit 5dabde2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -598,11 +598,11 @@ class ResolverImpl(

@KspExperimental
override fun getDeclarationsFromPackage(packageName: String): Sequence<KSDeclaration> {
module.getPackage(FqName(packageName)).memberScope
val res = (module as ModuleDescriptorImpl).packageFragmentProvider.packageFragments(FqName(packageName))
.flatMap{ it.getMemberScope().getContributedDescriptors() }
val noPackageFilter = DescriptorKindFilter.ALL.withoutKinds(DescriptorKindFilter.PACKAGES_MASK)
return module.getPackage(FqName(packageName))
.memberScope.getContributedDescriptors(noPackageFilter)
.mapNotNull { (it as? MemberDescriptor)?.toKSDeclaration() }
return res.asSequence()
.asSequence()
}

override fun getTypeArgument(typeRef: KSTypeReference, variance: Variance): KSTypeArgument {
Expand Down
1 change: 1 addition & 0 deletions docs/incremental.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ words, a processor needs to associate an output with the sources of the correspo
* `Resolver.getAllFiles`
* `Resolver.getSymbolsWithAnnotation`
* `Resolver.getClassDeclarationByName`
* `Resolver.getDeclarationsFromPackage`

Currently, only changes in Kotlin and Java sources are tracked. Changes to the classpath, namely to other modules
or libraries, trigger a full re-processing of all sources.
Expand Down

0 comments on commit 5dabde2

Please sign in to comment.