IR: rename {name,fqName}Safe -> {name,fqName}ForIrSerialization
These properties have a very specific detail in their behavior, in that the constructor's name is set to be "<init>". While this is OK for the IR serialization, this may not always be expected in other cases, and their rather common names (`name`, `fqNameSafe`) suggested that these properties could be used in generic contexts. Change all usages outside IR serialization to use `IrDeclarationWithName.name` and nullable `IrDeclarationWithName.fqNameWhenAvailable` instead
This commit is contained in:
+2
-2
@@ -18,7 +18,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
|
||||
import org.jetbrains.kotlin.ir.util.defaultType
|
||||
import org.jetbrains.kotlin.ir.util.fqNameSafe
|
||||
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
|
||||
import org.jetbrains.kotlin.ir.util.isEffectivelyExternal
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
@@ -158,5 +158,5 @@ class TestGenerator(val context: JsIrBackendContext) : FileLoweringPass {
|
||||
get() = hasAnnotation("kotlin.test.AfterTest")
|
||||
|
||||
private fun IrAnnotationContainer.hasAnnotation(fqName: String) =
|
||||
annotations.any { it.symbol.owner.parent.fqNameSafe == FqName(fqName) }
|
||||
annotations.any { it.symbol.owner.fqNameWhenAvailable?.parent()?.asString() == fqName }
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.util.fqNameSafe
|
||||
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
|
||||
|
||||
@@ -35,6 +35,6 @@ private fun IrTypeArgument.asString(): String = when(this) {
|
||||
|
||||
private fun IrClassifierSymbol.asString() = when (this) {
|
||||
is IrTypeParameterSymbol -> this.owner.name.asString()
|
||||
is IrClassSymbol -> this.owner.fqNameSafe.asString()
|
||||
is IrClassSymbol -> this.owner.fqNameWhenAvailable!!.asString()
|
||||
else -> error("Unexpected kind of IrClassifierSymbol: " + javaClass.typeName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user