Move DumpIrTreeWithDescriptorsVisitor to common package
This commit is contained in:
committed by
Svyatoslav Scherbina
parent
10ca3dbeca
commit
a81b6731f8
+1
-2
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.backend.common
|
package org.jetbrains.kotlin.backend.common
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.konan.ir.DeepCopyKonanIrTreeWithSymbols
|
|
||||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
|
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
@@ -42,7 +41,7 @@ fun IrElement.deepCopyWithVariablesImpl(): IrElement {
|
|||||||
acceptVoid(symbolsRemapper)
|
acceptVoid(symbolsRemapper)
|
||||||
|
|
||||||
return this.transform(
|
return this.transform(
|
||||||
object : DeepCopyKonanIrTreeWithSymbols(symbolsRemapper) {
|
object : DeepCopyIrTreeWithReturnableBlockSymbols(symbolsRemapper) {
|
||||||
override fun getNonTransformedLoop(irLoop: IrLoop): IrLoop {
|
override fun getNonTransformedLoop(irLoop: IrLoop): IrLoop {
|
||||||
return irLoop
|
return irLoop
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
package org.jetbrains.kotlin.backend.common
|
package org.jetbrains.kotlin.backend.common
|
||||||
|
|
||||||
import org.jetbrains.kotlin.backend.konan.ir.IrReturnableBlockImpl
|
import org.jetbrains.kotlin.backend.konan.ir.IrReturnableBlock
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
@@ -231,7 +231,7 @@ class DumpIrTreeWithDescriptorsVisitor(out: Appendable): IrElementVisitor<Unit,
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visitBlock(expression: IrBlock, data: String) {
|
override fun visitBlock(expression: IrBlock, data: String) {
|
||||||
if (expression is IrReturnableBlockImpl) {
|
if (expression is IrReturnableBlock) {
|
||||||
printer.println("RETURNABLE BLOCK " + expression.descriptor)
|
printer.println("RETURNABLE BLOCK " + expression.descriptor)
|
||||||
indented { super.visitBlock(expression, data) }
|
indented { super.visitBlock(expression, data) }
|
||||||
return
|
return
|
||||||
|
|||||||
+6
-3
@@ -14,8 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.backend.konan.ir
|
package org.jetbrains.kotlin.backend.common
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.backend.konan.ir.IrReturnableBlock
|
||||||
|
import org.jetbrains.kotlin.backend.konan.ir.IrReturnableBlockImpl
|
||||||
|
import org.jetbrains.kotlin.backend.konan.ir.IrReturnableBlockSymbol
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrBlock
|
import org.jetbrains.kotlin.ir.expressions.IrBlock
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrReturn
|
import org.jetbrains.kotlin.ir.expressions.IrReturn
|
||||||
@@ -23,12 +26,12 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrReturnImpl
|
|||||||
import org.jetbrains.kotlin.ir.util.DeepCopyIrTreeWithSymbols
|
import org.jetbrains.kotlin.ir.util.DeepCopyIrTreeWithSymbols
|
||||||
import org.jetbrains.kotlin.ir.util.SymbolRemapper
|
import org.jetbrains.kotlin.ir.util.SymbolRemapper
|
||||||
|
|
||||||
internal open class DeepCopyKonanIrTreeWithSymbols(
|
open class DeepCopyIrTreeWithReturnableBlockSymbols(
|
||||||
private val symbolRemapper: SymbolRemapper
|
private val symbolRemapper: SymbolRemapper
|
||||||
) : DeepCopyIrTreeWithSymbols(symbolRemapper) {
|
) : DeepCopyIrTreeWithSymbols(symbolRemapper) {
|
||||||
|
|
||||||
private inline fun <reified T : IrElement> T.transform() =
|
private inline fun <reified T : IrElement> T.transform() =
|
||||||
transform(this@DeepCopyKonanIrTreeWithSymbols, null) as T
|
transform(this@DeepCopyIrTreeWithReturnableBlockSymbols, null) as T
|
||||||
|
|
||||||
private val transformedReturnableBlocks = mutableMapOf<IrReturnableBlock, IrReturnableBlock>()
|
private val transformedReturnableBlocks = mutableMapOf<IrReturnableBlock, IrReturnableBlock>()
|
||||||
|
|
||||||
Reference in New Issue
Block a user