3 // System.Reflection.Emit/ModuleBuilder.cs
6 // Paolo Molaro (lupus@ximian.com)
8 // (C) 2001 Ximian, Inc. http://www.ximian.com
12 using System.Reflection;
13 using System.Runtime.CompilerServices;
15 namespace System.Reflection.Emit {
16 public class ModuleBuilder : Module {
17 private TypeBuilder[] types;
18 private int table_idx;
19 internal AssemblyBuilder assemblyb;
21 internal ModuleBuilder (AssemblyBuilder assb, string name, string fullyqname) {
22 this.name = this.scopename = name;
23 this.fqname = fullyqname;
24 this.assemblyb = assb;
25 table_idx = assb.get_next_table_index (0x00, true);
28 public override string FullyQualifiedName {get { return fqname;}}
30 public TypeBuilder DefineType (string name) {
31 // FIXME: LAMESPEC: what other attributes should we use here as default?
32 return DefineType (name, TypeAttributes.Public, typeof(object), null);
35 public TypeBuilder DefineType (string name, TypeAttributes attr) {
36 return DefineType (name, attr, typeof(object), null);
39 public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent) {
40 return DefineType (name, attr, parent, null);
43 public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, Type[] interfaces) {
44 TypeBuilder res = new TypeBuilder (this, name, attr, parent, interfaces);
46 TypeBuilder[] new_types = new TypeBuilder [types.Length];
47 System.Array.Copy (types, new_types, types.Length);
48 new_types [types.Length] = res;
51 types = new TypeBuilder [1];
57 public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, int typesize) {
58 return DefineType (name, attr, parent, null);
61 public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, PackingSize packsize) {
62 return DefineType (name, attr, parent, null);
65 public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, PackingSize packsize, int typesize) {
66 return DefineType (name, attr, parent, null);