public void endVisit(MessageSend call, BlockScope scope) {
//System.out.println("endVisit: " + call);
// an error has already occurred
if (call.codegenBinding == null) return;
MethodBinding superBinding = call.codegenBinding;
if (superBinding instanceof ProblemMethodBinding) {
return;
}
// InterTypeMethodBindings are always statically bound, so there's no
// need to treat super calls specially here
if (superBinding instanceof InterTypeMethodBinding) {
return;
// InterTypeMethodBinding m = (InterTypeMethodBinding)superBinding;
// if (m.postDispatchMethod != null) {
// call.binding = m.postDispatchMethod;
// }
// return;
}
EclipseFactory factory = ((AjLookupEnvironment)method.scope.environment()).factory;
char[] accessName;
if (call.isSuperAccess() && !call.binding.isStatic()) {
call.receiver = new ThisReference(call.receiver.sourceStart, call.receiver.sourceEnd);
accessName =
NameMangler.superDispatchMethod(factory.fromBinding(targetClass),
new String(superBinding.selector)).toCharArray();
} else if (call.receiver.isThis() && call.binding.isProtected() && !call.binding.isStatic()) {
//XXX this is a hack that violates some binary compatibility rules
if (superBinding.declaringClass.equals(targetClass)) {
accessName =
NameMangler.protectedDispatchMethod(factory.fromBinding(targetClass),
new String(superBinding.selector)).toCharArray();
} else {
accessName =
NameMangler.superDispatchMethod(factory.fromBinding(targetClass),
new String(superBinding.selector)).toCharArray();
}
} else {
return;
}
//??? do we want these to be unique
MethodBinding superAccessBinding =
new MethodBinding(ASTNode.AccPublic, accessName,
superBinding.returnType, superBinding.parameters, superBinding.thrownExceptions,
targetClass);
AstUtil.replaceMethodBinding(call, superAccessBinding);