2002-02-20 Ravi Pratap <ravi@ximian.com>
* expression.cs (Binary.ResolveOperator): Ensure that we are
- not trying to operate on a void type - this fixes Dan's bug.
+ not trying to operate on a void type - this fixes the reported
+ bug.
+
+ * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
+ the parent implementation is sealed.
+
+ * ../errors/cs0239.cs : Add.
+
+ * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
+
+ * typemanager.cs (unverifiable_code_type): Corresponds to
+ System.Security.UnverifiableCodeAttribute. We need to emit this for modules
+ which have unsafe code in them.
+
+ * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
+ unsafe context.
2002-02-19 Miguel de Icaza <miguel@ximian.com>
\r
} else if (kind is AssemblyBuilder){\r
((AssemblyBuilder) builder).SetCustomAttribute (cb);\r
+ } else if (kind is ModuleBuilder) {\r
+ ((ModuleBuilder) builder).SetCustomAttribute (cb);\r
} else\r
throw new Exception ("Unknown kind: " + kind);\r
}\r
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){
Attribute.ApplyAttributes (ec, ab, ab, global_attributes,
global_attributes.Location);
+ }
+
+ if (Unsafe) {
+ ConstructorInfo ci = TypeManager.unverifiable_code_type.GetConstructor (new Type [0]);
+
+ if (ci == null) {
+ Console.WriteLine ("Internal error !");
+ return;
+ }
+
+ CustomAttributeBuilder cb = new CustomAttributeBuilder (ci, new object [0]);
+ mb.SetCustomAttribute (cb);
}
}
static public Type runtime_field_handle_type;
static public Type attribute_usage_type;
static public Type dllimport_type;
+ static public Type unverifiable_code_type;
static public Type methodimpl_attr_type;
static public Type param_array_type;
static public Type void_ptr_type;
methodimpl_attr_type = CoreLookupType ("System.Runtime.CompilerServices.MethodImplAttribute");
param_array_type = CoreLookupType ("System.ParamArrayAttribute");
+ unverifiable_code_type = CoreLookupType ("System.Security.UnverifiableCodeAttribute");
+
void_ptr_type = CoreLookupType ("System.Void*");
//