Use hasInitializer() instead of getInitializer() in DescriptorResolver

This commit is contained in:
Pavel V. Talanov
2014-04-09 17:53:43 +04:00
parent b67b5f92f8
commit 5bf5dfc5a4
@@ -986,8 +986,7 @@ public class DescriptorResolver {
boolean hasDelegate = variable instanceof JetProperty && ((JetProperty) variable).hasDelegateExpression(); boolean hasDelegate = variable instanceof JetProperty && ((JetProperty) variable).hasDelegateExpression();
if (propertyTypeRef == null) { if (propertyTypeRef == null) {
final JetExpression initializer = variable.getInitializer(); if (!variable.hasInitializer()) {
if (initializer == null) {
if (hasDelegate && variableDescriptor instanceof PropertyDescriptor) { if (hasDelegate && variableDescriptor instanceof PropertyDescriptor) {
final JetProperty property = (JetProperty) variable; final JetProperty property = (JetProperty) variable;
final JetExpression propertyDelegateExpression = property.getDelegateExpression(); final JetExpression propertyDelegateExpression = property.getDelegateExpression();
@@ -1017,7 +1016,7 @@ public class DescriptorResolver {
new Function0<JetType>() { new Function0<JetType>() {
@Override @Override
public JetType invoke() { public JetType invoke() {
JetType initializerType = resolveInitializerType(scope, initializer, dataFlowInfo, trace); JetType initializerType = resolveInitializerType(scope, variable.getInitializer(), dataFlowInfo, trace);
setConstantForVariableIfNeeded(variableDescriptor, scope, variable, dataFlowInfo, initializerType, trace); setConstantForVariableIfNeeded(variableDescriptor, scope, variable, dataFlowInfo, initializerType, trace);
return transformAnonymousTypeIfNeeded(variableDescriptor, variable, initializerType, trace); return transformAnonymousTypeIfNeeded(variableDescriptor, variable, initializerType, trace);
} }
@@ -1025,7 +1024,7 @@ public class DescriptorResolver {
); );
} }
else { else {
JetType initializerType = resolveInitializerType(scope, initializer, dataFlowInfo, trace); JetType initializerType = resolveInitializerType(scope, variable.getInitializer(), dataFlowInfo, trace);
setConstantForVariableIfNeeded(variableDescriptor, scope, variable, dataFlowInfo, initializerType, trace); setConstantForVariableIfNeeded(variableDescriptor, scope, variable, dataFlowInfo, initializerType, trace);
return initializerType; return initializerType;
} }