Move DumpIrTreeWithDescriptorsVisitor to common package

This commit is contained in:
Mikhael Bogdanov
2017-06-09 11:41:11 +02:00
committed by Svyatoslav Scherbina
parent 10ca3dbeca
commit a81b6731f8
3 changed files with 9 additions and 7 deletions
@@ -16,7 +16,6 @@
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.impl.LocalVariableDescriptor
import org.jetbrains.kotlin.ir.IrElement
@@ -42,7 +41,7 @@ fun IrElement.deepCopyWithVariablesImpl(): IrElement {
acceptVoid(symbolsRemapper)
return this.transform(
object : DeepCopyKonanIrTreeWithSymbols(symbolsRemapper) {
object : DeepCopyIrTreeWithReturnableBlockSymbols(symbolsRemapper) {
override fun getNonTransformedLoop(irLoop: IrLoop): IrLoop {
return irLoop
}
@@ -1,6 +1,6 @@
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.ReceiverParameterDescriptor
import org.jetbrains.kotlin.ir.IrElement
@@ -231,7 +231,7 @@ class DumpIrTreeWithDescriptorsVisitor(out: Appendable): IrElementVisitor<Unit,
}
override fun visitBlock(expression: IrBlock, data: String) {
if (expression is IrReturnableBlockImpl) {
if (expression is IrReturnableBlock) {
printer.println("RETURNABLE BLOCK " + expression.descriptor)
indented { super.visitBlock(expression, data) }
return
@@ -14,8 +14,11 @@
* 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.expressions.IrBlock
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.SymbolRemapper
internal open class DeepCopyKonanIrTreeWithSymbols(
open class DeepCopyIrTreeWithReturnableBlockSymbols(
private val symbolRemapper: SymbolRemapper
) : DeepCopyIrTreeWithSymbols(symbolRemapper) {
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>()