[IR] Copied functions from IrGenerator to IrBuilder

With that the number of UNDEFINED_OFFSET should be greater reduced
This commit is contained in:
Igor Chevdar
2019-03-13 09:09:29 +03:00
parent 1ac25259e8
commit 3838a2f648
2 changed files with 42 additions and 5 deletions
@@ -295,3 +295,42 @@ fun IrBuilderWithScope.irSetField(receiver: IrExpression, irField: IrField, valu
value = value,
type = context.irBuiltIns.unitType
)
inline fun IrBuilderWithScope.irBlock(
startOffset: Int = this.startOffset,
endOffset: Int = this.endOffset,
origin: IrStatementOrigin? = null,
resultType: IrType? = null,
body: IrBlockBuilder.() -> Unit
): IrExpression =
IrBlockBuilder(
context, scope,
startOffset,
endOffset,
origin, resultType
).block(body)
inline fun IrBuilderWithScope.irComposite(
startOffset: Int = this.startOffset,
endOffset: Int = this.endOffset,
origin: IrStatementOrigin? = null,
resultType: IrType? = null,
body: IrBlockBuilder.() -> Unit
): IrExpression =
IrBlockBuilder(
context, scope,
startOffset,
endOffset,
origin, resultType, true
).block(body)
inline fun IrBuilderWithScope.irBlockBody(
startOffset: Int = this.startOffset,
endOffset: Int = this.endOffset,
body: IrBlockBodyBuilder.() -> Unit
): IrBlockBody =
IrBlockBodyBuilder(
context, scope,
startOffset,
endOffset
).blockBody(body)
@@ -143,8 +143,7 @@ fun <T : IrBuilder> T.at(startOffset: Int, endOffset: Int) = apply {
}
inline fun IrGeneratorWithScope.irBlock(
startOffset: Int = UNDEFINED_OFFSET,
endOffset: Int = UNDEFINED_OFFSET,
startOffset: Int, endOffset: Int,
origin: IrStatementOrigin? = null,
resultType: IrType? = null,
body: IrBlockBuilder.() -> Unit
@@ -157,8 +156,7 @@ inline fun IrGeneratorWithScope.irBlock(
).block(body)
inline fun IrGeneratorWithScope.irComposite(
startOffset: Int = UNDEFINED_OFFSET,
endOffset: Int = UNDEFINED_OFFSET,
startOffset: Int, endOffset: Int,
origin: IrStatementOrigin? = null,
resultType: IrType? = null,
body: IrBlockBuilder.() -> Unit
@@ -171,7 +169,7 @@ inline fun IrGeneratorWithScope.irComposite(
).block(body)
inline fun IrGeneratorWithScope.irBlockBody(
startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET,
startOffset: Int, endOffset: Int,
body: IrBlockBodyBuilder.() -> Unit
): IrBlockBody =
IrBlockBodyBuilder(