[IR] Add IR support for setting parameters.

Use it in the JVM_IR backend for default values code. The parameter
local has to be overwritten for the inliner to work.
This commit is contained in:
Mads Ager
2020-09-01 14:28:07 +02:00
committed by Alexander Udalov
parent db23460fd5
commit 9a93bb3f09
46 changed files with 107 additions and 144 deletions
@@ -607,11 +607,11 @@ abstract class IrFileDeserializer(
return IrSetFieldImpl(start, end, symbol, receiver, value, builtIns.unitType, origin, superQualifier)
}
private fun deserializeSetVariable(proto: ProtoSetVariable, start: Int, end: Int): IrSetVariable {
private fun deserializeSetVariable(proto: ProtoSetVariable, start: Int, end: Int): IrSetValue {
val symbol = deserializeIrSymbolAndRemap(proto.symbol) as IrVariableSymbol
val value = deserializeExpression(proto.value)
val origin = if (proto.hasOriginName()) deserializeIrStatementOrigin(proto.originName) else null
return IrSetVariableImpl(start, end, builtIns.unitType, symbol, value, origin)
return IrSetValueImpl(start, end, builtIns.unitType, symbol, value, origin)
}
private fun deserializeSpreadElement(proto: ProtoSpreadElement): IrSpreadElement {
@@ -673,7 +673,7 @@ open class IrFileSerializer(
}
.build()
private fun serializeSetVariable(expression: IrSetVariable): ProtoSetVariable =
private fun serializeSetVariable(expression: IrSetValue): ProtoSetVariable =
ProtoSetVariable.newBuilder()
.setSymbol(serializeIrSymbol(expression.symbol))
.setValue(serializeExpression(expression.value)).apply {
@@ -933,7 +933,7 @@ open class IrFileSerializer(
is IrPropertyReference -> operationProto.propertyReference = serializePropertyReference(expression)
is IrReturn -> operationProto.`return` = serializeReturn(expression)
is IrSetField -> operationProto.setField = serializeSetField(expression)
is IrSetVariable -> operationProto.setVariable = serializeSetVariable(expression)
is IrSetValue -> operationProto.setVariable = serializeSetVariable(expression)
is IrStringConcatenation -> operationProto.stringConcat = serializeStringConcat(expression)
is IrThrow -> operationProto.`throw` = serializeThrow(expression)
is IrTry -> operationProto.`try` = serializeTry(expression)