Skip to content

Commit

Permalink
RefinementVisitor: small refactor for ceylon/ceylon-compiler#390
Browse files Browse the repository at this point in the history
  • Loading branch information
FroMage committed Oct 18, 2012
1 parent add1d60 commit 2d8ade5
Showing 1 changed file with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -504,18 +504,12 @@ private void checkParameterTypes(Tree.Declaration that, Tree.ParameterList pl,
}
else {
//TODO: consider type parameter substitution!!!
if(refinedParams.isNamedParametersSupported()){
// it must be a Ceylon method
checkIsExactly(parameterType, refinedParameterType, type, "type of parameter " +
param.getName() + " is different to type of corresponding parameter " +
rparam.getName() + " of refined member");
}else{
// we're refining a Java method
ProducedType refinedDefiniteType = refinedMember.getDeclaration().getUnit().getDefiniteType(refinedParameterType);
checkIsExactlyOneOf(parameterType, refinedParameterType, refinedDefiniteType, type, "type of parameter " +
param.getName() + " is different to type of corresponding parameter " +
rparam.getName() + " of refined member");
}
checkIsExactlyForInterop(refinedMember,
refinedParams.isNamedParametersSupported(),
parameterType, refinedParameterType, type,
"type of parameter " +
param.getName() + " is different to type of corresponding parameter " +
rparam.getName() + " of refined member");
}
}
}
Expand All @@ -524,6 +518,18 @@ private void checkParameterTypes(Tree.Declaration that, Tree.ParameterList pl,
}
}

private void checkIsExactlyForInterop(ProducedReference refinedMember, boolean isCeylon,
ProducedType parameterType, ProducedType refinedParameterType, Tree.Type type, String message) {
if(isCeylon){
// it must be a Ceylon method
checkIsExactly(parameterType, refinedParameterType, type, message);
}else{
// we're refining a Java method
ProducedType refinedDefiniteType = refinedMember.getDeclaration().getUnit().getDefiniteType(refinedParameterType);
checkIsExactlyOneOf(parameterType, refinedParameterType, refinedDefiniteType, type, message);
}
}

private static Tree.ParameterList getParameterList(Tree.Declaration that, int i) {
Tree.ParameterList pl;
if (that instanceof Tree.AnyMethod) {
Expand Down

0 comments on commit 2d8ade5

Please sign in to comment.