* MethodDef.cs: Report when defining methods just like MS.
[mono.git] / mcs / ilasm / codegen / TypeDef.cs
index 35700c9c591f80285cadf9267a15ca032a66c1a3..2aee3ebd80ae915c71fa40505ff70a9987fef852 100644 (file)
@@ -269,6 +269,13 @@ namespace Mono.ILASM {
                         if (size != -1)
                                 classdef.AddLayoutInfo (pack, size);
 
+                        if (impl_list != null) {
+                                foreach (IClassRef impl in impl_list) {
+                                        impl.Resolve (code_gen);
+                                        classdef.AddImplementedInterface (impl.PeapiClass);
+                                }
+                        }
+
                         if (typar_list != null) {
                                 short index = 0;
                                 foreach (GenericInfo gi in typar_list) {
@@ -295,7 +302,7 @@ namespace Mono.ILASM {
                         }
 
                         foreach (MethodDef methoddef in method_table.Values) {
-                                methoddef.Define (code_gen, classdef);
+                                methoddef.Define (code_gen, this);
                         }
 
                         if (event_list != null) {
@@ -347,6 +354,11 @@ namespace Mono.ILASM {
                 {
                         MethodDef methoddef = (MethodDef) method_table[signature];
 
+                        if (methoddef == null) {
+                                code_gen.Report.Error ("Unable to resolve method: " + signature);
+                                Environment.Exit (1);
+                        }
+
                         return methoddef.Resolve (code_gen, classdef);
                 }
 
@@ -354,8 +366,13 @@ namespace Mono.ILASM {
                                 CodeGen code_gen, PEAPI.Type[] opt)
                 {
                         MethodDef methoddef = (MethodDef) method_table[signature];
-                        methoddef.Resolve (code_gen, classdef);
 
+                        if (methoddef == null) {
+                                code_gen.Report.Error ("Unable to resolve method: " + signature);
+                                Environment.Exit (1);
+                        }
+
+                        methoddef.Resolve (code_gen, classdef);
                         return methoddef.GetVarargSig (opt);
                 }