Make JvmPlatform.defaultImports a stored property

It was incorrectly made a getter-only property in 2f616bdd
This commit is contained in:
Alexander Udalov
2016-10-12 20:15:53 +03:00
parent ebc8002eb2
commit 321a19a247
@@ -26,31 +26,29 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScope
import java.util.* import java.util.*
object JvmPlatform : TargetPlatform("JVM") { object JvmPlatform : TargetPlatform("JVM") {
override val defaultImports: List<ImportPath> override val defaultImports: List<ImportPath> = ArrayList<ImportPath>().apply {
get() = ArrayList<ImportPath>().apply { add(ImportPath("java.lang.*"))
add(ImportPath("java.lang.*")) add(ImportPath("kotlin.*"))
add(ImportPath("kotlin.*")) add(ImportPath("kotlin.annotation.*"))
add(ImportPath("kotlin.annotation.*")) add(ImportPath("kotlin.jvm.*"))
add(ImportPath("kotlin.jvm.*")) add(ImportPath("kotlin.collections.*"))
add(ImportPath("kotlin.collections.*")) add(ImportPath("kotlin.coroutines.*"))
add(ImportPath("kotlin.coroutines.*")) add(ImportPath("kotlin.ranges.*"))
add(ImportPath("kotlin.ranges.*")) add(ImportPath("kotlin.sequences.*"))
add(ImportPath("kotlin.sequences.*")) add(ImportPath("kotlin.text.*"))
add(ImportPath("kotlin.text.*")) add(ImportPath("kotlin.io.*"))
add(ImportPath("kotlin.io.*"))
fun addAllClassifiersFromScope(scope: MemberScope) { fun addAllClassifiersFromScope(scope: MemberScope) {
for (descriptor in scope.getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS, MemberScope.ALL_NAME_FILTER)) { for (descriptor in scope.getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS, MemberScope.ALL_NAME_FILTER)) {
add(ImportPath(DescriptorUtils.getFqNameSafe(descriptor), false)) add(ImportPath(DescriptorUtils.getFqNameSafe(descriptor), false))
}
}
val builtIns = DefaultBuiltIns.Instance
for (builtinPackageFragment in builtIns.builtInsPackageFragments) {
addAllClassifiersFromScope(builtinPackageFragment.getMemberScope())
} }
} }
val builtIns = DefaultBuiltIns.Instance
for (builtinPackageFragment in builtIns.builtInsPackageFragments) {
addAllClassifiersFromScope(builtinPackageFragment.getMemberScope())
}
}
override val platformConfigurator: PlatformConfigurator = JvmPlatformConfigurator override val platformConfigurator: PlatformConfigurator = JvmPlatformConfigurator
} }