Report.error (arg.source_reference, "Invalid type for argument %d".printf (i + 1));
return false;
}
- } else if (arg.target_type != null
- && (direction == ParameterDirection.IN || direction == ParameterDirection.REF)
- && !arg.value_type.compatible (arg.target_type)) {
- Report.error (arg.source_reference, "Argument %d: Cannot convert from `%s' to `%s'".printf (i + 1, arg.value_type.to_string (), arg.target_type.to_string ()));
- return false;
- } else if (arg.target_type != null
- && (direction == ParameterDirection.REF || direction == ParameterDirection.OUT)
- && !arg.target_type.compatible (arg.value_type)
- && !(arg is NullLiteral)) {
- Report.error (arg.source_reference, "Argument %d: Cannot convert from `%s' to `%s'".printf (i + 1, arg.target_type.to_string (), arg.value_type.to_string ()));
- return false;
} else {
// 0 => null, 1 => in, 2 => ref, 3 => out
int arg_type = 1;
}
}
}
+
+ if (arg.target_type != null) {
+ if ((direction == ParameterDirection.IN || direction == ParameterDirection.REF)
+ && !arg.value_type.compatible (arg.target_type)) {
+ Report.error (arg.source_reference, "Argument %d: Cannot convert from `%s' to `%s'".printf (i + 1, arg.value_type.to_string (), arg.target_type.to_string ()));
+ return false;
+ } else if ((direction == ParameterDirection.REF || direction == ParameterDirection.OUT)
+ && !arg.target_type.compatible (arg.value_type)
+ && !(arg is NullLiteral)) {
+ Report.error (arg.source_reference, "Argument %d: Cannot convert from `%s' to `%s'".printf (i + 1, arg.target_type.to_string (), arg.value_type.to_string ()));
+ return false;
+ }
+ }
+
var ma = arg as MemberAccess;
if (ma != null && ma.prototype_access) {
// allow prototype access if target type is delegate without target