Author: marek
Date: 2007-11-02 16:44:40 -0500 (Fri, 02 Nov 2007)
New Revision: 88746
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/attribute.cs
trunk/mcs/mcs/rootcontext.cs
Log:
2007-11-02 Marek Safar <[EMAIL PROTECTED]>
A fix for bug #332909
* attribute.cs: Resolve attributes in correct context using error
handling procedure.
* rootcontext.cs: Define Obsolete attribute members as core members.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2007-11-02 21:02:47 UTC (rev 88745)
+++ trunk/mcs/mcs/ChangeLog 2007-11-02 21:44:40 UTC (rev 88746)
@@ -1,5 +1,13 @@
2007-11-02 Marek Safar <[EMAIL PROTECTED]>
+ A fix for bug #332909
+ * attribute.cs: Resolve attributes in correct context using error
+ handling procedure.
+
+ * rootcontext.cs: Define Obsolete attribute members as core members.
+
+2007-11-02 Marek Safar <[EMAIL PROTECTED]>
+
* statement.cs: Removed unused methods.
2007-10-31 Wade Berrier <[EMAIL PROTECTED]>
Modified: trunk/mcs/mcs/attribute.cs
===================================================================
--- trunk/mcs/mcs/attribute.cs 2007-11-02 21:02:47 UTC (rev 88745)
+++ trunk/mcs/mcs/attribute.cs 2007-11-02 21:44:40 UTC (rev 88746)
@@ -75,7 +75,8 @@
public abstract string[] ValidAttributeTargets { get; }
};
- public class Attribute {
+ public class Attribute : Expression
+ {
public readonly string ExplicitTarget;
public AttributeTargets Target;
@@ -87,10 +88,6 @@
readonly ArrayList PosArguments;
ArrayList NamedArguments;
- public readonly Location Location;
-
- public Type Type;
-
bool resolve_error;
readonly bool nameEscaped;
@@ -121,7 +118,7 @@
PosArguments = (ArrayList)args [0];
NamedArguments = (ArrayList)args [1];
}
- Location = loc;
+ this.loc = loc;
ExplicitTarget = target;
this.nameEscaped = nameEscaped;
}
@@ -288,7 +285,7 @@
return Type;
}
- public string GetSignatureForError ()
+ public override string GetSignatureForError ()
{
if (Type != null)
return TypeManager.CSharpName (Type);
@@ -363,7 +360,11 @@
}
Attributable owner = Owner;
- EmitContext ec = new EmitContext (owner.ResolveContext,
owner.ResolveContext.DeclContainer, owner.ResolveContext.DeclContainer,
+ DeclSpace ds = owner.ResolveContext as DeclSpace;
+ if (ds == null)
+ ds = owner.ResolveContext.DeclContainer;
+
+ EmitContext ec = new EmitContext (owner.ResolveContext,
ds, owner.ResolveContext.DeclContainer,
Location, null, typeof (Attribute),
owner.ResolveContext.DeclContainer.ModFlags, false);
ec.IsAnonymousMethodAllowed = false;
@@ -381,6 +382,10 @@
CustomAttributeBuilder cb;
try {
+ // SRE does not allow private ctor but we want
to report all source code errors
+ if (ctor.IsPrivate)
+ return null;
+
if (NamedArguments == null) {
cb = new CustomAttributeBuilder (ctor,
pos_values);
@@ -418,8 +423,8 @@
return null;
}
}
-
- MethodGroupExpr mg = Expression.MemberLookup
(ec.ContainerType,
+
+ MethodGroupExpr mg = MemberLookupFinal (ec, null,
Type, ".ctor", MemberTypes.Constructor,
BindingFlags.Public | BindingFlags.Instance |
BindingFlags.DeclaredOnly,
Location) as MethodGroupExpr;
@@ -1288,6 +1293,16 @@
return null;
return e.TypeArgument;
}
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ throw new NotImplementedException ();
+ }
}
Modified: trunk/mcs/mcs/rootcontext.cs
===================================================================
--- trunk/mcs/mcs/rootcontext.cs 2007-11-02 21:02:47 UTC (rev 88745)
+++ trunk/mcs/mcs/rootcontext.cs 2007-11-02 21:44:40 UTC (rev 88746)
@@ -276,6 +276,11 @@
BootstrapCorlib_ResolveInterface (root,
"System.Runtime.InteropServices._Attribute");
TypeManager.attribute_type =
BootstrapCorlib_ResolveClass (root, "System.Attribute");
TypeManager.obsolete_attribute_type =
BootstrapCorlib_ResolveClass (root, "System.ObsoleteAttribute");
+ if (TypeManager.obsolete_attribute_type != null) {
+ Class c = TypeManager.LookupClass
(TypeManager.obsolete_attribute_type);
+ c.DefineMembers ();
+ }
+
TypeManager.indexer_name_type =
BootstrapCorlib_ResolveClass (root,
"System.Runtime.CompilerServices.IndexerNameAttribute");
string [] interfaces_first_stage = {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches