Ejemplo n.º 1
0
  private boolean shouldInitializeProperty(@NotNull JetProperty property) {
    JetExpression initializer = property.getDelegateExpressionOrInitializer();
    if (initializer == null) return false;

    PropertyDescriptor propertyDescriptor =
        (PropertyDescriptor) bindingContext.get(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();
    JetType jetType = getPropertyOrDelegateType(property, propertyDescriptor);
    Type type = typeMapper.mapType(jetType);
    return !skipDefaultValue(propertyDescriptor, value, type);
  }