Implement property references in JVM_IR

This commit is contained in:
pyos
2019-03-08 14:59:54 +01:00
committed by max-kammerer
parent 43be01bbc8
commit 330c4648cb
11 changed files with 406 additions and 48 deletions
@@ -199,7 +199,7 @@ fun IrBuilderWithScope.irNotEquals(arg1: IrExpression, arg2: IrExpression) =
irEquals(arg1, arg2, origin = IrStatementOrigin.EXCLEQ)
)
fun IrBuilderWithScope.irGet(type: IrType, receiver: IrExpression, getterSymbol: IrFunctionSymbol): IrCall =
fun IrBuilderWithScope.irGet(type: IrType, receiver: IrExpression?, getterSymbol: IrFunctionSymbol): IrCall =
IrGetterCallImpl(
startOffset, endOffset,
type,
@@ -210,6 +210,18 @@ fun IrBuilderWithScope.irGet(type: IrType, receiver: IrExpression, getterSymbol:
origin = IrStatementOrigin.GET_PROPERTY
)
fun IrBuilderWithScope.irSet(type: IrType, receiver: IrExpression?, getterSymbol: IrFunctionSymbol, value: IrExpression): IrCall =
IrSetterCallImpl(
startOffset, endOffset,
type,
getterSymbol, getterSymbol.descriptor,
typeArgumentsCount = 0,
dispatchReceiver = receiver,
extensionReceiver = null,
argument = value,
origin = IrStatementOrigin.EQ
)
fun IrBuilderWithScope.irCall(callee: IrFunctionSymbol, type: IrType, typeArguments: List<IrType> = emptyList()): IrCall =
IrCallImpl(startOffset, endOffset, type, callee, callee.descriptor).apply {
typeArguments.forEachIndexed { index, irType ->