private Hashtable field_table;
private ArrayList field_list;
private Hashtable method_table;
+ private ArrayList method_list;
private ArrayList customattr_list;
private DeclSecurity decl_sec;
private ArrayList event_list;
field_list = new ArrayList ();
method_table = new Hashtable ();
+ method_list = new ArrayList ();
size = -1;
pack = -1;
this.attr |= PEAPI.TypeAttr.Abstract;
}
+ public bool NoAutoInherit { get; set; }
+
public string Name {
get { return name; }
}
Report.Error (methoddef.StartLocation, "Duplicate method declaration: " + methoddef.Signature);
method_table.Add (methoddef.Signature, methoddef);
+ method_list.Add (methoddef);
}
public void BeginEventDef (EventDef event_def)
if (IsValueType (parent.PeapiClass.nameSpace, parent.PeapiClass.name))
is_value_class = true;
- else if (IsEnumType (parent.PeapiClass.nameSpace, parent.PeapiClass.name))
+ else if (IsEnumType (parent.PeapiClass.nameSpace, parent.PeapiClass.name)) {
is_enum_class = true;
+ is_value_class = false;
+ }
if (!IsValueType (name_space, name) && !IsEnumType (name_space, name) &&
is_value_class && (attr & PEAPI.TypeAttr.Sealed) == 0) {
- Report.Warning (location, "Non-sealed value class, made sealed.");
attr |= PEAPI.TypeAttr.Sealed;
}
name_space, name);
}
}
- if (FullName == "System.Object")
+ if (FullName == "System.Object" || NoAutoInherit)
classdef.SpecialNoSuper ();
}
{
ArrayList fielddef_list = new ArrayList ();
foreach (FieldDef fielddef in field_list) {
+ if (is_enum_class && fielddef.Name == "value__") {
+ fielddef.Attributes |= PEAPI.FieldAttr.SpecialName | PEAPI.FieldAttr.RTSpecialName;
+ }
+
fielddef.Define (code_gen, classdef);
fielddef_list.Add (fielddef.PeapiFieldDef);
}
classdef.SetFieldOrder (fielddef_list);
- foreach (MethodDef methoddef in method_table.Values) {
+ foreach (MethodDef methoddef in method_list) {
methoddef.Define (code_gen);
}
public PEAPI.Method ResolveMethod (BaseTypeRef ret_type, PEAPI.CallConv call_conv,
string name, BaseTypeRef [] param, int gen_param_count, CodeGen code_gen)
{
- string signature = MethodDef.CreateSignature (ret_type, name, param, gen_param_count);
+ string signature = MethodDef.CreateSignature (ret_type, call_conv, name, param, gen_param_count, false);
MethodDef methoddef = (MethodDef) method_table[signature];
if (methoddef != null)
public PEAPI.Method ResolveVarargMethod (BaseTypeRef ret_type, PEAPI.CallConv call_conv,
string name, BaseTypeRef [] param, int gen_param_count, PEAPI.Type [] opt, CodeGen code_gen)
{
- string signature = MethodDef.CreateVarargSignature (ret_type, name, param);
+ // Only MethodDef sig required to lookup in the method_table
+ string signature = MethodDef.CreateSignature (ret_type, call_conv, name, param, 0, false);
MethodDef methoddef = (MethodDef) method_table[signature];
-
if (methoddef != null) {
methoddef.Resolve (code_gen, classdef);
- return methoddef.GetVarargSig (opt);
+ return methoddef.GetVarargSig (
+ opt,
+ MethodDef.CreateSignature (ret_type, call_conv, name, param, 0, true));
}
return ResolveAsMethodRef (ret_type, call_conv, name, param, gen_param_count, code_gen);