Properly process catch parameter declaration.

This commit is contained in:
Alexander Gorshenev
2017-11-13 14:18:25 +03:00
committed by alexander-gorshenev
parent bab0a85336
commit 0b096e2208
2 changed files with 3 additions and 4 deletions
@@ -336,7 +336,7 @@ message IrBlockBody {
} }
message IrCatch { message IrCatch {
required KotlinDescriptor parameter = 1; required IrDeclaration catch_parameter = 1;
required IrExpression result = 2; required IrExpression result = 2;
} }
@@ -151,7 +151,7 @@ internal class IrSerializer(val context: Context,
fun serializeCatch(catch: IrCatch): KonanIr.IrCatch { fun serializeCatch(catch: IrCatch): KonanIr.IrCatch {
val proto = KonanIr.IrCatch.newBuilder() val proto = KonanIr.IrCatch.newBuilder()
.setParameter(serializeDescriptor(catch.parameter)) .setCatchParameter(serializeDeclaration(catch.catchParameter))
.setResult(serializeExpression(catch.result)) .setResult(serializeExpression(catch.result))
return proto.build() return proto.build()
} }
@@ -708,8 +708,7 @@ internal class IrDeserializer(val context: Context,
} }
fun deserializeCatch(proto: KonanIr.IrCatch, start: Int, end: Int): IrCatch { fun deserializeCatch(proto: KonanIr.IrCatch, start: Int, end: Int): IrCatch {
val parameter = deserializeDescriptor(proto.getParameter()) as VariableDescriptor val catchParameter = deserializeDeclaration(proto.catchParameter) as IrVariable
val catchParameter = IrVariableImpl(start, end, IrDeclarationOrigin.CATCH_PARAMETER, parameter)
val result = deserializeExpression(proto.getResult()) val result = deserializeExpression(proto.getResult())
return IrCatchImpl(start, end, catchParameter, result) return IrCatchImpl(start, end, catchParameter, result)