protected virtual void SetupMethod(CallExpression call,
MethodInfo method,
TypeData receiverType)
{
if (!method.IsPublic &&
typeManager.GetTypeData(currentClass.TypeBuilder) !=
receiverType) {
report.Error(call.Location,
"cannot call private routine {0}",
call.Name);
return;
}
call.Method = method;
call.NodeType = typeManager.GetReturnType(method);
ParameterInfo[] parameters = typeManager.GetParameters(method);
int i = 0;
foreach (ModalExpression arg in call.Arguments) {
ParameterInfo param = parameters[i++];
if (arg.NodeType == null) // void expression
arg.NodeType = typeManager.GetTypeData(param.ParameterType);
}
if (call.Receiver == null &&
(call.IsBuiltin || !method.IsStatic)) {
call.Receiver = new VoidExpression(call.Location);
call.Receiver.NodeType = receiverType;
}
}