Fix interpreter error related to incorrect work of get value for objects

This commit is contained in:
Ivan Kylchik
2020-08-31 19:17:47 +03:00
committed by TeamCityServer
parent d931e2eead
commit b98f680d65
@@ -569,9 +569,12 @@ class IrInterpreter(private val irBuiltIns: IrBuiltIns, private val bodyMap: Map
}
private fun interpretGetValue(expression: IrGetValue): ExecutionResult {
val owner = expression.type.classOrNull?.owner
val expectedClass = expression.type.classOrNull?.owner
// used to evaluate constants inside object
if (owner != null && owner.isObject) return getOrCreateObjectValue(owner) // TODO is this correct behaviour?
if (expectedClass != null && expectedClass.isObject && expression.symbol.owner.origin == IrDeclarationOrigin.INSTANCE_RECEIVER) {
// TODO is this correct behaviour?
return getOrCreateObjectValue(expectedClass)
}
stack.pushReturnValue(stack.getVariable(expression.symbol).state)
return Next
}