[IR] Rename IrTypeTransformerVoid to IrTypeTransformer
This naming is more consistent with already existing `IrElementTransformerVoid` and `IrElementTransformer`
This commit is contained in:
+2
-2
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.ir.interpreter.checker.IrInterpreterChecker
|
|||||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.types.typeOrNull
|
import org.jetbrains.kotlin.ir.types.typeOrNull
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrTypeTransformerVoid
|
import org.jetbrains.kotlin.ir.visitors.IrTypeTransformer
|
||||||
|
|
||||||
internal class IrConstTypeAnnotationTransformer(
|
internal class IrConstTypeAnnotationTransformer(
|
||||||
interpreter: IrInterpreter,
|
interpreter: IrInterpreter,
|
||||||
@@ -30,7 +30,7 @@ internal class IrConstTypeAnnotationTransformer(
|
|||||||
suppressExceptions: Boolean,
|
suppressExceptions: Boolean,
|
||||||
) : IrConstAnnotationTransformer(
|
) : IrConstAnnotationTransformer(
|
||||||
interpreter, irFile, mode, checker, evaluatedConstTracker, inlineConstTracker, onWarning, onError, suppressExceptions
|
interpreter, irFile, mode, checker, evaluatedConstTracker, inlineConstTracker, onWarning, onError, suppressExceptions
|
||||||
), IrTypeTransformerVoid<IrConstTransformer.Data> {
|
), IrTypeTransformer<IrConstTransformer.Data> {
|
||||||
|
|
||||||
override fun <Type : IrType?> transformType(container: IrElement, type: Type, data: Data): Type {
|
override fun <Type : IrType?> transformType(container: IrElement, type: Type, data: Data): Type {
|
||||||
if (type == null) return type
|
if (type == null) return type
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.ir.expressions.IrTypeOperatorCall
|
|||||||
import org.jetbrains.kotlin.ir.expressions.IrVararg
|
import org.jetbrains.kotlin.ir.expressions.IrVararg
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
|
|
||||||
interface IrTypeTransformerVoid<in D> : IrElementTransformer<D> {
|
interface IrTypeTransformer<in D> : IrElementTransformer<D> {
|
||||||
fun <Type : IrType?> transformType(
|
fun <Type : IrType?> transformType(
|
||||||
container: IrElement,
|
container: IrElement,
|
||||||
type: Type,
|
type: Type,
|
||||||
+4
-4
@@ -18,7 +18,7 @@ import java.io.File
|
|||||||
private val visitorTypeName = ClassName(VISITOR_PACKAGE, "IrElementVisitor")
|
private val visitorTypeName = ClassName(VISITOR_PACKAGE, "IrElementVisitor")
|
||||||
private val visitorVoidTypeName = ClassName(VISITOR_PACKAGE, "IrElementVisitorVoid")
|
private val visitorVoidTypeName = ClassName(VISITOR_PACKAGE, "IrElementVisitorVoid")
|
||||||
private val transformerTypeName = ClassName(VISITOR_PACKAGE, "IrElementTransformer")
|
private val transformerTypeName = ClassName(VISITOR_PACKAGE, "IrElementTransformer")
|
||||||
private val typeTransformerVoidTypeName = ClassName(VISITOR_PACKAGE, "IrTypeTransformerVoid")
|
private val typeTransformerTypeName = ClassName(VISITOR_PACKAGE, "IrTypeTransformer")
|
||||||
|
|
||||||
fun printVisitor(generationPath: File, model: Model): GeneratedFile {
|
fun printVisitor(generationPath: File, model: Model): GeneratedFile {
|
||||||
val visitorType = TypeSpec.interfaceBuilder(visitorTypeName).apply {
|
val visitorType = TypeSpec.interfaceBuilder(visitorTypeName).apply {
|
||||||
@@ -153,7 +153,7 @@ fun printTypeVisitor(generationPath: File, model: Model): GeneratedFile {
|
|||||||
return irTypeFields + parentsFields
|
return irTypeFields + parentsFields
|
||||||
}
|
}
|
||||||
|
|
||||||
val visitorType = TypeSpec.interfaceBuilder(typeTransformerVoidTypeName).apply {
|
val visitorType = TypeSpec.interfaceBuilder(typeTransformerTypeName).apply {
|
||||||
val d = TypeVariableName("D", KModifier.IN)
|
val d = TypeVariableName("D", KModifier.IN)
|
||||||
addTypeVariable(d)
|
addTypeVariable(d)
|
||||||
addSuperinterface(transformerTypeName.parameterizedBy(d))
|
addSuperinterface(transformerTypeName.parameterizedBy(d))
|
||||||
@@ -190,7 +190,7 @@ fun printTypeVisitor(generationPath: File, model: Model): GeneratedFile {
|
|||||||
if (irTypeFields.singleOrNull()?.name != "typeArguments") {
|
if (irTypeFields.singleOrNull()?.name != "typeArguments") {
|
||||||
error(
|
error(
|
||||||
"""`Ir${IrTree.memberAccessExpression.name.capitalizeAsciiOnly()}` has unexpected fields with `IrType` type.
|
"""`Ir${IrTree.memberAccessExpression.name.capitalizeAsciiOnly()}` has unexpected fields with `IrType` type.
|
||||||
|Please adjust logic of `${typeTransformerVoidTypeName.simpleName}`'s generation.""".trimMargin()
|
|Please adjust logic of `${typeTransformerTypeName.simpleName}`'s generation.""".trimMargin()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
beginControlFlow("(0 until $visitorParam.typeArgumentsCount).forEach {")
|
beginControlFlow("(0 until $visitorParam.typeArgumentsCount).forEach {")
|
||||||
@@ -213,7 +213,7 @@ fun printTypeVisitor(generationPath: File, model: Model): GeneratedFile {
|
|||||||
}
|
}
|
||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
return printTypeCommon(generationPath, typeTransformerVoidTypeName.packageName, visitorType)
|
return printTypeCommon(generationPath, typeTransformerTypeName.packageName, visitorType)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Element.getTransformExplicitType(): Element {
|
private fun Element.getTransformExplicitType(): Element {
|
||||||
|
|||||||
Reference in New Issue
Block a user