}
}
+ public bool ResolveError {
+ get {
+ return resolve_error;
+ }
+ }
+
public ATypeNameExpression TypeExpression {
get {
return expression;
/// <summary>
/// Tries to resolve the type of the attribute. Flags an error if it can't, and complain is true.
/// </summary>
- void ResolveAttributeType ()
+ void ResolveAttributeType (bool comparisonOnly)
{
SessionReportPrinter resolve_printer = new SessionReportPrinter ();
ReportPrinter prev_recorder = Report.SetPrinter (resolve_printer);
}
if (t1_is_attr && t2_is_attr && t1 != t2) {
- Report.Error (1614, Location, "`{0}' is ambiguous between `{1}' and `{2}'. Use either `@{0}' or `{0}Attribute'",
- GetSignatureForError (), expression.GetSignatureForError (), expanded.GetSignatureForError ());
- resolve_error = true;
+ if (!comparisonOnly) {
+ Report.Error (1614, Location, "`{0}' is ambiguous between `{1}' and `{2}'. Use either `@{0}' or `{0}Attribute'",
+ GetSignatureForError (), expression.GetSignatureForError (), expanded.GetSignatureForError ());
+ resolve_error = true;
+ }
+
return;
}
return;
}
+ if (comparisonOnly)
+ return;
+
resolve_error = true;
if (t1 != null) {
resolve_printer.Merge (prev_recorder);
}
- public TypeSpec ResolveType ()
+ public TypeSpec ResolveTypeForComparison ()
{
if (Type == null && !resolve_error)
- ResolveAttributeType ();
+ ResolveAttributeType (true);
return Type;
}
arg_resolved = true;
if (Type == null) {
- ResolveAttributeType ();
+ ResolveAttributeType (false);
if (Type == null)
return null;
}
}
}
+ public bool HasResolveError()
+ {
+ foreach (var a in Attrs) {
+ if (a.ResolveError)
+ return true;
+ }
+
+ return false;
+ }
+
public Attribute Search (PredefinedAttribute t)
{
return Search (null, t);
if (explicitTarget != null && a.ExplicitTarget != explicitTarget)
continue;
- if (a.ResolveType () == t)
+ if (a.ResolveTypeForComparison () == t)
return a;
}
return null;
List<Attribute> ar = null;
foreach (Attribute a in Attrs) {
- if (a.ResolveType () == t) {
+ if (a.ResolveTypeForComparison () == t) {
if (ar == null)
ar = new List<Attribute> (Attrs.Count);
ar.Add (a);