IR: introduce abstract class IrDeclarationBase
The main purpose of this class is to improve performance of IR visitors and transformers. `IrElementVisitor.visitDeclaration` now takes IrDeclarationBase as a parameter, and therefore the call to `accept` there is now a virtual class call, instead of an interface call.
This commit is contained in:
+3
-3
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.backend.common.serialization.mangle
|
||||
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationBase
|
||||
import org.jetbrains.kotlin.ir.util.KotlinMangler
|
||||
import org.jetbrains.kotlin.ir.util.render
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||
@@ -47,8 +48,7 @@ class ManglerChecker(vararg _manglers: KotlinMangler<IrDeclaration>) : IrElement
|
||||
return r
|
||||
}
|
||||
|
||||
override fun visitDeclaration(declaration: IrDeclaration) {
|
||||
|
||||
override fun visitDeclaration(declaration: IrDeclarationBase) {
|
||||
val exported = manglers.checkAllEqual(false, { isExportCheck(declaration) }) { m1, r1, m2, r2 ->
|
||||
error("${declaration.render()}\n ${m1.manglerName}: $r1\n ${m2.manglerName}: $r2\n")
|
||||
}
|
||||
@@ -69,4 +69,4 @@ class ManglerChecker(vararg _manglers: KotlinMangler<IrDeclaration>) : IrElement
|
||||
|
||||
declaration.acceptChildrenVoid(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ abstract class IrExportCheckerVisitor : IrElementVisitor<Boolean, Nothing?>, Kot
|
||||
|
||||
override fun visitElement(element: IrElement, data: Nothing?): Boolean = error("Should bot reach here ${element.render()}")
|
||||
|
||||
override fun visitDeclaration(declaration: IrDeclaration, data: Nothing?) = declaration.run { isExported(annotations, null) }
|
||||
override fun visitDeclaration(declaration: IrDeclarationBase, data: Nothing?) = declaration.run { isExported(annotations, null) }
|
||||
|
||||
override fun visitAnonymousInitializer(declaration: IrAnonymousInitializer, data: Nothing?) = false
|
||||
override fun visitValueParameter(declaration: IrValueParameter, data: Nothing?) = false
|
||||
|
||||
Reference in New Issue
Block a user