Browse Source

2002-05-30 Martin Baulig <[email protected]>

	* AssemblyBuilder.cs (methods): Made this internal and don't
	initialize it.  It will be initialized by the ModuleBuilder's
	GetSymbolWriter() method.
	(get_next_table_index): Only store the method in the `methods'
	array if it's not null.

	* ModuleBuilder.cs (GetSymbolWriter): Initialize the AssemblyBuilder's
	`methods' field if necessary and pass it as third argument to the
	symbol writer's constructor.

svn path=/trunk/mcs/; revision=5030
Martin Baulig 23 years ago
parent
commit
39b7e0e8af

+ 2 - 3
mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs

@@ -27,7 +27,7 @@ namespace System.Reflection.Emit {
 		private string dir;
 		private CustomAttributeBuilder[] cattrs;
 		private int[] table_indexes;
-		private ArrayList methods;
+		internal ArrayList methods;
 
 		[MethodImplAttribute(MethodImplOptions.InternalCall)]
 		private static extern void basic_init (AssemblyBuilder ab);
@@ -35,7 +35,6 @@ namespace System.Reflection.Emit {
 		internal AssemblyBuilder (AssemblyName n, string directory, AssemblyBuilderAccess access) {
 			name = n.Name;
 			dir = directory;
-			methods = new ArrayList ();
 			basic_init (this);
 		}
 
@@ -49,7 +48,7 @@ namespace System.Reflection.Emit {
 			}
 			// Console.WriteLine ("getindex for table "+table.ToString()+" got "+table_indexes [table].ToString());
 			if (inc) {
-				if (table == 0x06)
+				if ((table == 0x06) && (methods != null))
 					methods.Add (obj);
 				return table_indexes [table]++;
 			}

+ 12 - 0
mcs/class/corlib/System.Reflection.Emit/ChangeLog

@@ -1,3 +1,15 @@
+2002-05-30  Martin Baulig  <[email protected]>
+
+	* AssemblyBuilder.cs (methods): Made this internal and don't
+	initialize it.  It will be initialized by the ModuleBuilder's
+	GetSymbolWriter() method.
+	(get_next_table_index): Only store the method in the `methods'
+	array if it's not null.
+
+	* ModuleBuilder.cs (GetSymbolWriter): Initialize the AssemblyBuilder's
+	`methods' field if necessary and pass it as third argument to the
+	symbol writer's constructor.
+
 2002-05-25  Martin Baulig  <[email protected]>
 
 	* TypeBuilder.cs (TypeToken): Implemented.

+ 7 - 2
mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs

@@ -52,16 +52,21 @@ namespace System.Reflection.Emit {
 			if (type == null)
 				return;
 
+			if (assemblyb.methods == null)
+				assemblyb.methods = new ArrayList ();
+
 			// First get the constructor.
 			{
-				Type[] arg_types = new Type [2];
+				Type[] arg_types = new Type [3];
 				arg_types [0] = typeof (ModuleBuilder);
 				arg_types [1] = typeof (string);
+				arg_types [2] = typeof (ArrayList);
 				ConstructorInfo constructor = type.GetConstructor (arg_types);
 
-				object[] args = new object [2];
+				object[] args = new object [3];
 				args [0] = this;
 				args [1] = filename;
+				args [2] = assemblyb.methods;
 
 				if (constructor == null)
 					return;