StorageManager for compile-time initializer
This commit is contained in:
@@ -1731,12 +1731,12 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
JetExpression initializer = property.getDelegateExpressionOrInitializer();
|
||||
if (initializer == null) return false;
|
||||
|
||||
CompileTimeConstant<?> compileTimeValue = ExpressionCodegen.getCompileTimeConstant(initializer, typeMapper.getBindingContext());
|
||||
if (compileTimeValue == null) return true;
|
||||
|
||||
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) typeMapper.getBindingContext().get(BindingContext.VARIABLE, property);
|
||||
assert propertyDescriptor != null;
|
||||
|
||||
CompileTimeConstant<?> compileTimeValue = propertyDescriptor.getCompileTimeInitializer();
|
||||
if (compileTimeValue == null) return true;
|
||||
|
||||
//TODO: OPTIMIZATION: don't initialize static final fields
|
||||
|
||||
Object value = compileTimeValue.getValue();
|
||||
|
||||
@@ -235,10 +235,9 @@ public class PropertyCodegen extends GenerationStateAware {
|
||||
Object value = null;
|
||||
|
||||
if (ImplementationBodyCodegen.shouldWriteFieldInitializer(propertyDescriptor, typeMapper)) {
|
||||
JetExpression initializer = p instanceof JetProperty ? ((JetProperty) p).getInitializer() : null;
|
||||
CompileTimeConstant<?> initializer = propertyDescriptor.getCompileTimeInitializer();
|
||||
if (initializer != null) {
|
||||
CompileTimeConstant<?> compileTimeValue = ExpressionCodegen.getCompileTimeConstant(initializer, bindingContext);
|
||||
value = compileTimeValue != null ? compileTimeValue.getValue() : null;
|
||||
value = initializer.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user