+ void ResolveCallerAttributes (ResolveContext rc)
+ {
+ var pa = rc.Module.PredefinedAttributes;
+ TypeSpec caller_type;
+
+ foreach (var attr in attributes.Attrs) {
+ var atype = attr.ResolveType ();
+ if (atype == null)
+ continue;
+
+ if (atype == pa.CallerMemberNameAttribute) {
+ caller_type = rc.BuiltinTypes.String;
+ if (caller_type != parameter_type && !Convert.ImplicitReferenceConversionExists (caller_type, parameter_type)) {
+ rc.Report.Error (4019, attr.Location,
+ "The CallerMemberName attribute cannot be applied because there is no standard conversion from `{0}' to `{1}'",
+ caller_type.GetSignatureForError (), parameter_type.GetSignatureForError ());
+ }
+
+ modFlags |= Modifier.CallerMemberName;
+ continue;
+ }
+
+ if (atype == pa.CallerLineNumberAttribute) {
+ caller_type = rc.BuiltinTypes.Int;
+ if (caller_type != parameter_type && !Convert.ImplicitNumericConversionExists (caller_type, parameter_type)) {
+ rc.Report.Error (4017, attr.Location,
+ "The CallerMemberName attribute cannot be applied because there is no standard conversion from `{0}' to `{1}'",
+ caller_type.GetSignatureForError (), parameter_type.GetSignatureForError ());
+ }
+
+ modFlags |= Modifier.CallerLineNumber;
+ continue;
+ }
+
+ if (atype == pa.CallerFilePathAttribute) {
+ caller_type = rc.BuiltinTypes.String;
+ if (caller_type != parameter_type && !Convert.ImplicitReferenceConversionExists (caller_type, parameter_type)) {
+ rc.Report.Error (4018, attr.Location,
+ "The CallerFilePath attribute cannot be applied because there is no standard conversion from `{0}' to `{1}'",
+ caller_type.GetSignatureForError (), parameter_type.GetSignatureForError ());
+ }
+
+ modFlags |= Modifier.CallerFilePath;
+ continue;
+ }
+ }
+ }
+