IR: make IrBody and subtypes classes
This commit is contained in:
+1
-2
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.ir.expressions.impl
|
package org.jetbrains.kotlin.ir.expressions.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.ir.IrElementBase
|
|
||||||
import org.jetbrains.kotlin.ir.IrStatement
|
import org.jetbrains.kotlin.ir.IrStatement
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||||
@@ -25,7 +24,7 @@ import org.jetbrains.kotlin.ir.expressions.IrBlockBody
|
|||||||
class IrBlockBodyImpl(
|
class IrBlockBodyImpl(
|
||||||
override val startOffset: Int,
|
override val startOffset: Int,
|
||||||
override val endOffset: Int
|
override val endOffset: Int
|
||||||
) : IrElementBase(), IrBlockBody {
|
) : IrBlockBody() {
|
||||||
constructor(startOffset: Int, endOffset: Int, statements: List<IrStatement>) : this(startOffset, endOffset) {
|
constructor(startOffset: Int, endOffset: Int, statements: List<IrStatement>) : this(startOffset, endOffset) {
|
||||||
this.statements.addAll(statements)
|
this.statements.addAll(statements)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.ir.expressions.impl
|
package org.jetbrains.kotlin.ir.expressions.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.ir.IrElementBase
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
@@ -26,7 +25,7 @@ class IrExpressionBodyImpl(
|
|||||||
override val startOffset: Int,
|
override val startOffset: Int,
|
||||||
override val endOffset: Int,
|
override val endOffset: Int,
|
||||||
initializer: (IrExpressionBody.() -> Unit)? = null
|
initializer: (IrExpressionBody.() -> Unit)? = null
|
||||||
) : IrElementBase(), IrExpressionBody {
|
) : IrExpressionBody() {
|
||||||
init {
|
init {
|
||||||
initializer?.invoke(this)
|
initializer?.invoke(this)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-4
@@ -29,10 +29,7 @@ internal class PersistentIrBlockBody(
|
|||||||
override val startOffset: Int,
|
override val startOffset: Int,
|
||||||
override val endOffset: Int,
|
override val endOffset: Int,
|
||||||
override var initializer: (PersistentIrBlockBody.() -> Unit)? = null
|
override var initializer: (PersistentIrBlockBody.() -> Unit)? = null
|
||||||
) :
|
) : IrBlockBody(), PersistentIrBodyBase<PersistentIrBlockBody> {
|
||||||
PersistentIrBodyBase<PersistentIrBlockBody>,
|
|
||||||
IrBlockBody {
|
|
||||||
|
|
||||||
override var lastModified: Int = stageController.currentStage
|
override var lastModified: Int = stageController.currentStage
|
||||||
override var loweredUpTo: Int = stageController.currentStage
|
override var loweredUpTo: Int = stageController.currentStage
|
||||||
override var values: Array<Carrier>? = null
|
override var values: Array<Carrier>? = null
|
||||||
|
|||||||
+1
-4
@@ -30,10 +30,7 @@ internal class PersistentIrExpressionBody private constructor(
|
|||||||
override val endOffset: Int,
|
override val endOffset: Int,
|
||||||
private var expressionField: IrExpression? = null,
|
private var expressionField: IrExpression? = null,
|
||||||
override var initializer: (PersistentIrExpressionBody.() -> Unit)? = null
|
override var initializer: (PersistentIrExpressionBody.() -> Unit)? = null
|
||||||
) :
|
) : IrExpressionBody(), PersistentIrBodyBase<PersistentIrExpressionBody> {
|
||||||
PersistentIrBodyBase<PersistentIrExpressionBody>,
|
|
||||||
IrExpressionBody {
|
|
||||||
|
|
||||||
override var lastModified: Int = stageController.currentStage
|
override var lastModified: Int = stageController.currentStage
|
||||||
override var loweredUpTo: Int = stageController.currentStage
|
override var loweredUpTo: Int = stageController.currentStage
|
||||||
override var values: Array<Carrier>? = null
|
override var values: Array<Carrier>? = null
|
||||||
|
|||||||
@@ -16,20 +16,20 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.ir.expressions
|
package org.jetbrains.kotlin.ir.expressions
|
||||||
|
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElementBase
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||||
|
|
||||||
interface IrBody : IrElement {
|
abstract class IrBody : IrElementBase() {
|
||||||
override fun <D> transform(transformer: IrElementTransformer<D>, data: D): IrBody =
|
override fun <D> transform(transformer: IrElementTransformer<D>, data: D): IrBody =
|
||||||
accept(transformer, data) as IrBody
|
accept(transformer, data) as IrBody
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IrExpressionBody : IrBody {
|
abstract class IrExpressionBody : IrBody() {
|
||||||
val factory: IrFactory
|
abstract val factory: IrFactory
|
||||||
|
|
||||||
var expression: IrExpression
|
abstract var expression: IrExpression
|
||||||
|
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||||
visitor.visitExpressionBody(this, data)
|
visitor.visitExpressionBody(this, data)
|
||||||
@@ -46,8 +46,8 @@ interface IrExpressionBody : IrBody {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IrBlockBody : IrBody, IrStatementContainer {
|
abstract class IrBlockBody : IrBody(), IrStatementContainer {
|
||||||
val factory: IrFactory
|
abstract val factory: IrFactory
|
||||||
|
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||||
visitor.visitBlockBody(this, data)
|
visitor.visitBlockBody(this, data)
|
||||||
@@ -63,8 +63,8 @@ interface IrBlockBody : IrBody, IrStatementContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IrSyntheticBody : IrBody {
|
abstract class IrSyntheticBody : IrBody() {
|
||||||
val kind: IrSyntheticBodyKind
|
abstract val kind: IrSyntheticBodyKind
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class IrSyntheticBodyKind {
|
enum class IrSyntheticBodyKind {
|
||||||
|
|||||||
+1
-2
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.ir.expressions.impl
|
package org.jetbrains.kotlin.ir.expressions.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.ir.IrElementBase
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrSyntheticBody
|
import org.jetbrains.kotlin.ir.expressions.IrSyntheticBody
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind
|
import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||||
@@ -26,7 +25,7 @@ class IrSyntheticBodyImpl(
|
|||||||
override val startOffset: Int,
|
override val startOffset: Int,
|
||||||
override val endOffset: Int,
|
override val endOffset: Int,
|
||||||
override val kind: IrSyntheticBodyKind
|
override val kind: IrSyntheticBodyKind
|
||||||
) : IrElementBase(), IrSyntheticBody {
|
) : IrSyntheticBody() {
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||||
return visitor.visitSyntheticBody(this, data)
|
return visitor.visitSyntheticBody(this, data)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user