Allow to interpret non const properties of compile time object

This commit is contained in:
Ivan Kylchik
2021-06-24 15:17:51 +03:00
committed by TeamCityServer
parent 1978bfcd85
commit 295638b26e
2 changed files with 5 additions and 3 deletions
@@ -374,7 +374,9 @@ class IrInterpreter(internal val environment: IrInterpreterEnvironment, internal
}
expression.accessesTopLevelOrObjectField() -> {
val propertyOwner = field.correspondingPropertySymbol?.owner
val isConst = propertyOwner?.isConst == true || propertyOwner?.backingField?.initializer?.expression is IrConst<*>
val isConst = propertyOwner?.isConst == true ||
propertyOwner?.backingField?.initializer?.expression is IrConst<*> ||
propertyOwner?.parentClassOrNull?.hasAnnotation(compileTimeAnnotation) == true // check if object is marked as compile time
verify(isConst) { "Cannot interpret get method on top level non const properties" }
callStack.addInstruction(CompoundInstruction(field.initializer?.expression))
}