Get rid of cli dependencies from ir
This commit is contained in:
@@ -9,7 +9,6 @@ dependencies {
|
||||
compile(project(":compiler:util"))
|
||||
compile(project(":compiler:frontend"))
|
||||
compile(project(":compiler:ir.tree"))
|
||||
compile(project(":compiler:cli-common"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
+3
-3
@@ -2,13 +2,13 @@ package org.jetbrains.kotlin.backend.common
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.ir.Ir
|
||||
import org.jetbrains.kotlin.builtins.KOTLIN_REFLECT_FQ_NAME
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
@@ -35,7 +35,7 @@ interface CommonBackendContext : BackendContext {
|
||||
|
||||
fun log(message: () -> String)
|
||||
|
||||
val messageCollector: MessageCollector
|
||||
fun report(element: IrElement?, irFile: IrFile?, message: String, isError: Boolean)
|
||||
}
|
||||
|
||||
class ReflectionTypes(module: ModuleDescriptor, internalPackage: FqName) {
|
||||
|
||||
@@ -16,14 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.common
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.ir.util.getCompilerMessageLocation
|
||||
|
||||
fun CommonBackendContext.reportWarning(message: String, irFile: IrFile, irElement: IrElement) {
|
||||
val location = irElement.getCompilerMessageLocation(irFile)
|
||||
messageCollector.report(CompilerMessageSeverity.WARNING, message, location)
|
||||
report(irElement, irFile, message, false)
|
||||
}
|
||||
|
||||
fun <E> MutableList<E>.push(element: E) = this.add(element)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.ir.util
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.atMostOne
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
@@ -122,16 +121,6 @@ fun IrExpression.isNullConst() = this is IrConst<*> && this.kind == IrConstKind.
|
||||
fun IrCall.usesDefaultArguments(): Boolean =
|
||||
this.descriptor.valueParameters.any { this.getValueArgument(it) == null }
|
||||
|
||||
fun IrElement.getCompilerMessageLocation(containingFile: IrFile): CompilerMessageLocation? {
|
||||
val sourceRangeInfo = containingFile.fileEntry.getSourceRangeInfo(this.startOffset, this.endOffset)
|
||||
return CompilerMessageLocation.create(
|
||||
path = sourceRangeInfo.filePath,
|
||||
line = sourceRangeInfo.startLineNumber,
|
||||
column = sourceRangeInfo.startColumnNumber,
|
||||
lineContent = null // TODO: retrieve the line content.
|
||||
)
|
||||
}
|
||||
|
||||
fun IrFunction.createParameterDeclarations() {
|
||||
fun ParameterDescriptor.irValueParameter() = IrValueParameterImpl(
|
||||
innerStartOffset(this), innerEndOffset(this),
|
||||
|
||||
Reference in New Issue
Block a user