.kotlin.kotlin-compiler.1.3.11.source-code.IrSuspendImpl.kt Maven / Gradle / Ivy
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.ir.expressions.impl
import org.jetbrains.kotlin.ir.declarations.IrVariable
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrSuspendableExpression
import org.jetbrains.kotlin.ir.expressions.IrSuspensionPoint
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrSuspensionPointImpl(
startOffset: Int,
endOffset: Int,
type: IrType,
override var suspensionPointIdParameter: IrVariable,
override var result: IrExpression,
override var resumeResult: IrExpression
) : IrExpressionBase(startOffset, endOffset, type), IrSuspensionPoint {
override fun accept(visitor: IrElementVisitor, data: D): R =
visitor.visitSuspensionPoint(this, data)
override fun acceptChildren(visitor: IrElementVisitor, data: D) {
suspensionPointIdParameter.accept(visitor, data)
result.accept(visitor, data)
resumeResult.accept(visitor, data)
}
override fun transformChildren(transformer: IrElementTransformer, data: D) {
suspensionPointIdParameter = suspensionPointIdParameter.transform(transformer, data) as IrVariable
result = result.transform(transformer, data)
resumeResult = resumeResult.transform(transformer, data)
}
}
class IrSuspendableExpressionImpl(
startOffset: Int,
endOffset: Int,
type: IrType,
override var suspensionPointId: IrExpression,
override var result: IrExpression
) : IrExpressionBase(startOffset, endOffset, type), IrSuspendableExpression {
override fun accept(visitor: IrElementVisitor, data: D): R =
visitor.visitSuspendableExpression(this, data)
override fun acceptChildren(visitor: IrElementVisitor, data: D) {
suspensionPointId.accept(visitor, data)
result.accept(visitor, data)
}
override fun transformChildren(transformer: IrElementTransformer, data: D) {
suspensionPointId = suspensionPointId.transform(transformer, data)
result = result.transform(transformer, data)
}
}