if (!(mb.IsAbstract || mb.IsVirtual)){
Report.Error (
506, Location, parent.MakeName (Name) +
- ": cannot override inherited member `" +
- mb.ReflectedType.Name + "' because it is not " +
+ ": cannot override inherited member " +
+ MethodBaseName (mb) + " because it is not " +
"virtual, abstract or override");
ok = false;
}
+
+ // Now we check that the overriden method is not final
+
+ if (mb.IsFinal) {
+ Report.Error (239, Location, parent.MakeName (Name) + " : cannot " +
+ "override inherited member " + MethodBaseName (mb) +
+ " because it is sealed.");
+ ok = false;
+ }
}
if (mb.IsVirtual || mb.IsAbstract){
}
public abstract bool Define (TypeContainer parent);
+
+ //
+ // Whehter is it ok to use an unsafe pointer in this type container
+ //
+ public bool UnsafeOK (DeclSpace parent)
+ {
+ //
+ // First check if this MemberCore modifier flags has unsafe set
+ //
+ if ((ModFlags & Modifiers.UNSAFE) != 0)
+ return true;
+
+ if (parent.UnsafeContext)
+ return true;
+
+ Expression.UnsafeError (Location);
+ return false;
+ }
}
//
/// </summary>
protected Hashtable defined_names;
- public DeclSpace (string name, Location l)
+ TypeContainer parent;
+
+ public DeclSpace (TypeContainer parent, string name, Location l)
: base (name, l)
{
Basename = name.Substring (1 + name.LastIndexOf ('.'));
defined_names = new Hashtable ();
+ this.parent = parent;
}
/// <summary>
}
}
+ public TypeContainer Parent {
+ get {
+ return parent;
+ }
+ }
+
public virtual void CloseType ()
{
if (!Created){
Created = true;
}
}
+
+ //
+ // Whether this is an `unsafe context'
+ //
+ public bool UnsafeContext {
+ get {
+ if ((ModFlags & Modifiers.UNSAFE) != 0)
+ return true;
+ if (parent != null)
+ return parent.UnsafeContext;
+ return false;
+ }
+ }
+
}
}