refactoring: moved method

This commit is contained in:
Svetlana Isakova
2013-09-25 20:52:23 +04:00
parent c150c22473
commit ac33ccc0fe
3 changed files with 25 additions and 25 deletions
@@ -568,8 +568,8 @@ public class CandidateResolver {
} }
constraintSystem.registerTypeVariables(typeVariables); constraintSystem.registerTypeVariables(typeVariables);
TypeSubstitutor substituteDontCare = ConstraintsUtil TypeSubstitutor substituteDontCare =
.makeConstantSubstitutor(candidateWithFreshVariables.getTypeParameters(), DONT_CARE); makeConstantSubstitutor(candidateWithFreshVariables.getTypeParameters(), DONT_CARE);
// Value parameters // Value parameters
for (Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> entry : candidateCall.getValueArguments().entrySet()) { for (Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> entry : candidateCall.getValueArguments().entrySet()) {
@@ -111,27 +111,4 @@ public class ConstraintsUtil {
} }
return true; return true;
} }
public static TypeSubstitutor makeConstantSubstitutor(Collection<TypeParameterDescriptor> typeParameterDescriptors, JetType type) {
final Set<TypeConstructor> constructors = Sets.newHashSet();
for (TypeParameterDescriptor typeParameterDescriptor : typeParameterDescriptors) {
constructors.add(typeParameterDescriptor.getTypeConstructor());
}
final TypeProjection projection = new TypeProjection(type);
return TypeSubstitutor.create(new TypeSubstitution() {
@Override
public TypeProjection get(TypeConstructor key) {
if (constructors.contains(key)) {
return projection;
}
return null;
}
@Override
public boolean isEmpty() {
return false;
}
});
}
} }
@@ -707,4 +707,27 @@ public class TypeUtils {
} }
); );
} }
public static TypeSubstitutor makeConstantSubstitutor(Collection<TypeParameterDescriptor> typeParameterDescriptors, JetType type) {
final Set<TypeConstructor> constructors = Sets.newHashSet();
for (TypeParameterDescriptor typeParameterDescriptor : typeParameterDescriptors) {
constructors.add(typeParameterDescriptor.getTypeConstructor());
}
final TypeProjection projection = new TypeProjection(type);
return TypeSubstitutor.create(new TypeSubstitution() {
@Override
public TypeProjection get(TypeConstructor key) {
if (constructors.contains(key)) {
return projection;
}
return null;
}
@Override
public boolean isEmpty() {
return false;
}
});
}
} }