Pull down some implementation details from DeserializedPackageFragment

- DeserializedPackageFragmentImpl doesn't actually need member scope to be lazy
in a sense of optimization. It was only necessary for breaking
initialization cycle: DeserializationComponents <-> DeserializedPackageFragment
- For MetadataPackageFragment it might be useful to have
member scope actually lazy since it has O(n) complexity when n is a number
of package parts

This change is helpful for avoidance of storing reference to package-proto

 #KT-24513 In Progress
This commit is contained in:
Denis Zharkov
2018-05-30 14:49:15 +03:00
parent 99b44faf5a
commit 0a3e8fbe66
7 changed files with 40 additions and 30 deletions
@@ -46,8 +46,11 @@ class KotlinJavascriptPackageFragment(
}
}
private val annotationDeserializer: AnnotationDeserializer by storageManager.createLazyValue {
AnnotationDeserializer(module, components.notFoundClasses)
private lateinit var annotationDeserializer: AnnotationDeserializer
override fun initialize(components: DeserializationComponents) {
super.initialize(components)
this.annotationDeserializer = AnnotationDeserializer(components.moduleDescriptor, components.notFoundClasses)
}
fun getContainingFileAnnotations(descriptor: DeclarationDescriptor): List<AnnotationDescriptor> {
@@ -80,7 +80,7 @@ fun createKotlinJavascriptPackageFragmentProvider(
)
for (packageFragment in packageFragments.filterIsInstance<KotlinJavascriptPackageFragment>()) {
packageFragment.components = components
packageFragment.initialize(components)
}
return provider