Avoid retaining protobuf package within DeserializedPackageFragmentImpl

It's only used for DeserializedPackageMemberScope that's being created
during initialization

At the same time, protobuf objects may be not very light-weight
(see 2e933a165a)

 #KT-24513 Fixed
This commit is contained in:
Denis Zharkov
2018-05-30 14:03:08 +03:00
parent 0a3e8fbe66
commit 01a2330a70
2 changed files with 7 additions and 4 deletions
@@ -40,11 +40,10 @@ class KotlinJavascriptPackageFragment(
header: JsProtoBuf.Header,
configuration: DeserializationConfiguration
) : DeserializedPackageFragmentImpl(fqName, storageManager, module, proto, JsContainerSource(fqName, header, configuration)) {
val fileMap: Map<Int, FileHolder> by storageManager.createLazyValue {
this.proto.getExtension(JsProtoBuf.packageFragmentFiles).fileList.withIndex().associate { (index, file) ->
val fileMap: Map<Int, FileHolder> =
proto.getExtension(JsProtoBuf.packageFragmentFiles).fileList.withIndex().associate { (index, file) ->
(if (file.hasId()) file.id else index) to FileHolder(file.annotationList)
}
}
private lateinit var annotationDeserializer: AnnotationDeserializer