Wrap captured local delegated property into Delegate

#KT-16864 Fixed
This commit is contained in:
Mikhael Bogdanov
2017-05-18 16:20:47 +02:00
parent fec8f4a48b
commit 47fec6c9d5
9 changed files with 73 additions and 1 deletions
@@ -1740,7 +1740,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
int parameterOffsetInConstructor = context.closure.getCapturedParameterOffsetInConstructor(descriptor);
// when captured parameter is singleton
// see compiler/testData/codegen/box/objects/objectInLocalAnonymousObject.kt (fun local() captured in A)
if (parameterOffsetInConstructor == -1) return parentResult;
if (parameterOffsetInConstructor == -1) return adjustVariableValue(parentResult , descriptor);
assert parentResult instanceof StackValue.Field || parentResult instanceof StackValue.FieldForSharedVar
: "Part of closure should be either Field or FieldForSharedVar";