merge -r 61110:61111
[mono.git] / mcs / ilasm / codegen / Module.cs
1 //
2 // Mono.ILASM.Module
3 //
4 // Author(s):
5 //  Ankit Jain  <jankit@novell.com>
6 //
7 // Copyright 2006 Novell, Inc (http://www.novell.com)
8 //
9
10 using System;
11 using System.Collections;
12
13 namespace Mono.ILASM {
14
15         public class Module : ExternRef {
16
17                 PEAPI.Module module;
18
19                 public Module (string name)
20                         : base (name)
21                 {
22                 }
23
24                 public PEAPI.Module PeapiModule {
25                         get { return module; }
26                         set { module = value; }
27                 }
28
29                 public override string FullName {
30                         get { 
31                                 //'name' field should not contain the [ ]
32                                 //as its used for resolving
33                                 return String.Format ("[{0}]", name); 
34                         }
35                 }
36
37                 public override PEAPI.IExternRef GetExternRef ()
38                 {
39                         return module;
40                 }
41
42                 public override void Resolve (CodeGen code_gen)
43                 {
44                         throw new InternalErrorException ("This should not get called");
45                 }
46
47                 public void Resolve (CodeGen code_gen, PEAPI.Module module)
48                 {
49                         this.module = module;
50
51                         if (customattr_list == null)
52                                 return;
53
54                         foreach (CustomAttr customattr in customattr_list)
55                                 customattr.AddTo (code_gen, module);
56                 }
57         }
58 }