small refactoring

This commit is contained in:
Svetlana Isakova
2013-06-06 16:30:43 +04:00
parent f41584c7ab
commit 12ef42b6ae
@@ -551,20 +551,21 @@ public class BodyResolver {
} }
addConstraintForThisValue(constraintSystem, descriptor); addConstraintForThisValue(constraintSystem, descriptor);
} }
if (propertyDescriptor.isVar()) { if (!propertyDescriptor.isVar()) return;
OverloadResolutionResults<FunctionDescriptor> setMethodResults =
DelegatedPropertyUtils.getDelegatedPropertyConventionMethod(
propertyDescriptor, delegateExpression, returnType, expressionTypingServices,
traceToResolveConventionMethods, accessorScope, false);
if (conventionMethodFound(setMethodResults)) { OverloadResolutionResults<FunctionDescriptor> setMethodResults =
FunctionDescriptor descriptor = setMethodResults.getResultingDescriptor(); DelegatedPropertyUtils.getDelegatedPropertyConventionMethod(
List<ValueParameterDescriptor> valueParameters = descriptor.getValueParameters(); propertyDescriptor, delegateExpression, returnType, expressionTypingServices,
if (valueParameters.size() == 3) { traceToResolveConventionMethods, accessorScope, false);
ValueParameterDescriptor valueParameterForThis = valueParameters.get(2);
constraintSystem.addSubtypeConstraint(expectedType, valueParameterForThis.getType(), ConstraintPosition.FROM_COMPLETER); if (conventionMethodFound(setMethodResults)) {
addConstraintForThisValue(constraintSystem, descriptor); FunctionDescriptor descriptor = setMethodResults.getResultingDescriptor();
} List<ValueParameterDescriptor> valueParameters = descriptor.getValueParameters();
if (valueParameters.size() == 3) {
ValueParameterDescriptor valueParameterForThis = valueParameters.get(2);
constraintSystem.addSubtypeConstraint(expectedType, valueParameterForThis.getType(), ConstraintPosition.FROM_COMPLETER);
addConstraintForThisValue(constraintSystem, descriptor);
} }
} }
} }
@@ -585,6 +586,7 @@ public class BodyResolver {
List<ValueParameterDescriptor> valueParameters = resultingDescriptor.getValueParameters(); List<ValueParameterDescriptor> valueParameters = resultingDescriptor.getValueParameters();
if (valueParameters.isEmpty()) return; if (valueParameters.isEmpty()) return;
ValueParameterDescriptor valueParameterForThis = valueParameters.get(0); ValueParameterDescriptor valueParameterForThis = valueParameters.get(0);
constraintSystem.addSubtypeConstraint(typeOfThis, valueParameterForThis.getType(), ConstraintPosition.FROM_COMPLETER); constraintSystem.addSubtypeConstraint(typeOfThis, valueParameterForThis.getType(), ConstraintPosition.FROM_COMPLETER);
} }
}; };