/// Base representation for members. This is only used to keep track
/// of Name, Location and Modifier flags.
/// </summary>
- public abstract class MemberCore {
+ public abstract class MemberCore : Attributable
+ {
/// <summary>
/// Public name
/// </summary>
/// </summary>
public readonly Location Location;
- public MemberCore (string name, Location loc)
+ public MemberCore (string name, Attributes attrs, Location loc)
+ : base (attrs)
{
Name = name;
Location = loc;
// FIXME: report the old/new permissions?
//
Report.Error (
- 507, Location, parent.MakeName (Name) +
+ 31048, Location, parent.MakeName (Name) +
": can't change the access modifiers when overriding inherited " +
"member `" + name + "'");
}
if ((ModFlags & Modifiers.OVERRIDE) != 0){
// Now we check that the overriden method is not final
- if (mb.IsFinal) \r
+ if (mb.IsFinal)
{
Report.Error (30267, Location, parent.MakeName (Name) + " : cannot " +
"override inherited member `" + name +
/// </summary>
NameExists,
- /// <summary>
- /// Returned if the declation being added to the
- /// name space clashes with its container name.
- ///
- /// The only exceptions for this are constructors
- /// and static constructors
- /// </summary>
- EnclosingClash,
-
/// <summary>
/// Returned if a constructor was created (because syntactically
/// it looked like a constructor) but was not (because the name
TypeContainer parent;
- public DeclSpace (TypeContainer parent, string name, Location l)
- : base (name, l)
+ public DeclSpace (TypeContainer parent, string name, Attributes attrs, Location l)
+ : base (name, attrs, l)
{
Basename = name.Substring (1 + name.LastIndexOf ('.'));
defined_names = new Hashtable ();
/// </summary>
protected AdditionResult IsValid (string name)
{
- if (name == Basename)
- return AdditionResult.EnclosingClash;
-
if (defined_names.Contains (name))
return AdditionResult.NameExists;
Expression d = e.Resolve (type_resolve_ec, ResolveFlags.Type);
if (d == null || d.eclass != ExprClass.Type){
if (!silent && errors == Report.Errors){
- Report.Error (246, loc, "Cannot find type `"+ e.ToString () +"'");
+ Report.Error (30002, loc, "Cannot find type `"+ e.ToString () +"'");
}
return null;
}
Expression d = e.Resolve (type_resolve_ec, ResolveFlags.Type);
if (d == null || d.eclass != ExprClass.Type){
if (!silent){
- Report.Error (246, loc, "Cannot find type `"+ e +"'");
+ Report.Error (30002, loc, "Cannot find type `"+ e +"'");
}
return null;
}
//
// Now check the using clause list
//
- ICollection imports_list = RootContext.SourceBeingCompiled.ImportsTable;\r
-\r
- if (imports_list == null)\r
- continue;\r
+ ICollection imports_list = RootContext.SourceBeingCompiled.ImportsTable;
+
+ if (imports_list == null)
+ continue;
Type match = null;
foreach (SourceBeingCompiled.ImportsEntry ue in imports_list){
public abstract MemberCache MemberCache {
get;
}
+
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
+ {
+ try {
+ TypeBuilder.SetCustomAttribute (cb);
+ } catch (System.ArgumentException e) {
+ Report.Warning (-21, a.Location,
+ "The CharSet named property on StructLayout\n"+
+ "\tdoes not work correctly on Microsoft.NET\n"+
+ "\tYou might want to remove the CharSet declaration\n"+
+ "\tor compile using the Mono runtime instead of the\n"+
+ "\tMicrosoft .NET runtime\n"+
+ "\tThe runtime gave the error: " + e);
+ }
+ }
}
+
/// <summary>
/// This is a readonly list of MemberInfo's.
/// </summary>
IDictionaryEnumerator it = parent.member_hash.GetEnumerator ();
while (it.MoveNext ()) {
- hash [it.Key] = ((ArrayList) it.Value).Clone ();
+ ArrayList al = (ArrayList) it.Value;
+ // Constructors are never inherited and all have the same key
+ if ((((CacheEntry)al [0]).EntryType & EntryType.Constructor) == 0)
+ hash [it.Key] = ((ArrayList) it.Value).Clone ();
}
return hash;
void AddMembers (MemberTypes mt, BindingFlags bf, IMemberContainer container)
{
MemberList members = container.GetMembers (mt, bf);
- BindingFlags new_bf = (container == Container) ?
+ /*BindingFlags new_bf = (container == Container) ?
bf | BindingFlags.DeclaredOnly : bf;
-
+ */
foreach (MemberInfo member in members) {
string name = member.Name;
// iteration of this loop if there are no members with the name we're
// looking for in the current class).
if (entry.Container != current) {
- if (declared_only || DoneSearching (list))
+ //if (declared_only || DoneSearching (list))
+ if (declared_only)
break;
current = entry.Container;