org.jetbrains.kotlin.resolve.ModuleStructureOracle.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-compiler-embeddable Show documentation
Show all versions of kotlin-compiler-embeddable Show documentation
the Kotlin compiler embeddable
/*
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.resolve
import org.jetbrains.kotlin.container.DefaultImplementation
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
@DefaultImplementation(ModuleStructureOracle.SingleModule::class)
interface ModuleStructureOracle {
// May be faster than `findAllReversedDependsOnPaths(module).isNotEmpty()`
fun hasImplementingModules(module: ModuleDescriptor): Boolean
fun findAllReversedDependsOnPaths(module: ModuleDescriptor): List
fun findAllDependsOnPaths(module: ModuleDescriptor): List
/**
* Works like all sources are effectively in one module.
*
* This is the mode CLI currently operates in.
*/
object SingleModule : ModuleStructureOracle {
override fun hasImplementingModules(module: ModuleDescriptor): Boolean = false
override fun findAllReversedDependsOnPaths(module: ModuleDescriptor): List = listOf(ModulePath(module))
override fun findAllDependsOnPaths(module: ModuleDescriptor): List = listOf(ModulePath(module))
}
}
class ModulePath(val nodes: List) {
constructor(vararg nodes: ModuleDescriptor) : this(nodes.toList())
}