* AssemblyBuilder.cs (methods): New field.
(get_next_table_index): Record all methods and constructors
(table 0x06) in the `methods' array. This is read by the
Mono.CSharp.Debugger.MonoSymbolWriter::get_method interncall to
get the MethodBuilder / ConstructorBuilder back from the token.
* *Builder.cs (get_next_table_index): Added `object obj' argument.
(<constructors>): pass the this pointer to get_next_table_index ().
svn path=/trunk/mcs/; revision=4856
using System.Runtime.Serialization;
using System.Globalization;
using System.Runtime.CompilerServices;
+using System.Collections;
namespace System.Reflection.Emit {
private string dir;
private CustomAttributeBuilder[] cattrs;
private int[] table_indexes;
+ private ArrayList methods;
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void basic_init (AssemblyBuilder ab);
internal AssemblyBuilder (AssemblyName n, string directory, AssemblyBuilderAccess access) {
name = n.Name;
dir = directory;
+ methods = new ArrayList ();
basic_init (this);
}
- internal int get_next_table_index (int table, bool inc) {
+ internal int get_next_table_index (object obj, int table, bool inc) {
if (table_indexes == null) {
table_indexes = new int [64];
for (int i=0; i < 64; ++i)
table_indexes [0x02] = 2;
}
// Console.WriteLine ("getindex for table "+table.ToString()+" got "+table_indexes [table].ToString());
- if (inc)
+ if (inc) {
+ if (table == 0x06)
+ methods.Add (obj);
return table_indexes [table]++;
+ }
return table_indexes [table];
}
+2002-05-22 Martin Baulig <martin@gnome.org>
+
+ * AssemblyBuilder.cs (methods): New field.
+ (get_next_table_index): Record all methods and constructors
+ (table 0x06) in the `methods' array. This is read by the
+ Mono.CSharp.Debugger.MonoSymbolWriter::get_method interncall to
+ get the MethodBuilder / ConstructorBuilder back from the token.
+
+ * *Builder.cs (get_next_table_index): Added `object obj' argument.
+ (<constructors>): pass the this pointer to get_next_table_index ().
+
2002-05-20 Martin Baulig <martin@gnome.org>
* TypeBuilder.cs (DefineField): Call the new `create_internal_class'
System.Array.Copy (parameterTypes, this.parameters, parameterTypes.Length);
}
type = tb;
- table_idx = get_next_table_index (0x06, true);
+ table_idx = get_next_table_index (this, 0x06, true);
}
public bool InitLocals {
if (ilgen != null)
ilgen.label_fixup ();
}
- internal override int get_next_table_index (int table, bool inc) {
- return type.get_next_table_index (table, inc);
+ internal override int get_next_table_index (object obj, int table, bool inc) {
+ return type.get_next_table_index (obj, table, inc);
}
}
attrs = eventAttrs;
type = eventType;
typeb = tb;
- table_idx = get_next_table_index (0x14, true);
+ table_idx = get_next_table_index (this, 0x14, true);
}
- internal int get_next_table_index (int table, bool inc) {
- return typeb.get_next_table_index (table, inc);
+ internal int get_next_table_index (object obj, int table, bool inc) {
+ return typeb.get_next_table_index (obj, table, inc);
}
public void AddOtherMethod( MethodBuilder mdBuilder) {
this.type = type;
offset = -1;
typeb = tb;
- table_idx = tb.get_next_table_index (0x04, true);
+ table_idx = tb.get_next_table_index (this, 0x04, true);
}
public override FieldAttributes Attributes {
System.Array.Copy (parameterTypes, this.parameters, parameterTypes.Length);
}
type = tb;
- table_idx = get_next_table_index (0x06, true);
+ table_idx = get_next_table_index (this, 0x06, true);
//Console.WriteLine ("index for "+name+" set to "+table_idx.ToString());
}
public void SetImplementationFlags( MethodImplAttributes attributes) {
iattrs = attributes;
}
- internal override int get_next_table_index (int table, bool inc) {
- return type.get_next_table_index (table, inc);
+ internal override int get_next_table_index (object obj, int table, bool inc) {
+ return type.get_next_table_index (obj, table, inc);
}
internal void set_override (MethodInfo mdecl) {
this.fqname = fullyqname;
this.assembly = this.assemblyb = assb;
guid = Guid.NewGuid().ToByteArray ();
- table_idx = get_next_table_index (0x00, true);
+ table_idx = get_next_table_index (this, 0x00, true);
name_cache = new Hashtable ();
if (emitSymbolInfo)
if (type == null)
return null;
- Type[] arg_types = new Type [1];
- arg_types [0] = typeof (string);
+ Type[] arg_types = new Type [2];
+ arg_types [0] = typeof (ModuleBuilder);
+ arg_types [1] = typeof (string);
ConstructorInfo constructor = type.GetConstructor (arg_types);
- object[] args = new object [1];
- args [0] = filename;
+ object[] args = new object [2];
+ args [0] = this;
+ args [1] = filename;
if (constructor == null)
return null;
return result;
}
- internal int get_next_table_index (int table, bool inc) {
- return assemblyb.get_next_table_index (table, inc);
+ internal int get_next_table_index (object obj, int table, bool inc) {
+ return assemblyb.get_next_table_index (obj, table, inc);
}
public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
position = pos;
attrs = attributes;
methodb = mb;
- table_idx = mb.get_next_table_index (0x08, true);
+ table_idx = mb.get_next_table_index (this, 0x08, true);
}
public virtual int Attributes {
System.Array.Copy (parameterTypes, this.parameters, this.parameters.Length);
}
typeb = tb;
- table_idx = tb.get_next_table_index (0x17, true);
+ table_idx = tb.get_next_table_index (this, 0x17, true);
}
public override PropertyAttributes Attributes {
}
pmodule = mb;
// skip .<Module> ?
- table_idx = mb.get_next_table_index (0x02, true);
+ table_idx = mb.get_next_table_index (this, 0x02, true);
setup_internal_class (this);
}
public void SetParent (Type parentType) {
parent = parentType;
}
- internal int get_next_table_index (int table, bool inc) {
- return pmodule.get_next_table_index (table, inc);
+ internal int get_next_table_index (object obj, int table, bool inc) {
+ return pmodule.get_next_table_index (obj, table, inc);
}
}