2010-03-17 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mcs / ilasm / codegen / SwitchInstr.cs
index 380c21e5061bc773a20e677631b9af4e98606f0b..810e779628db8ccd0489308ec2f6038daf7655a2 100644 (file)
@@ -17,12 +17,14 @@ namespace Mono.ILASM {
 
                 private ArrayList label_list;
 
-                public SwitchInstr (ArrayList label_list)
+                public SwitchInstr (ArrayList label_list, Location loc)
+                       : base (loc)
                 {
                         this.label_list = label_list;
                 }
 
-                public void Emit (CodeGen code_gen, MethodDef meth, PEAPI.CILInstructions cil)
+                public override void Emit (CodeGen code_gen, MethodDef meth,
+                                          PEAPI.CILInstructions cil)
                 {
                         int count = 0;
                         PEAPI.CILLabel[] label_array;
@@ -30,10 +32,10 @@ namespace Mono.ILASM {
                         if (label_list != null) {
                                 label_array = new PEAPI.CILLabel[label_list.Count];
                                 foreach (object lab in label_list) {
-                                        if (lab is string) {
-                                                label_array[count++] = meth.GetLabelDef ((string) lab);
+                                        if (lab is LabelInfo) {
+                                                label_array[count++] = ((LabelInfo)lab).Label;
                                         } else {                                                
-                                                throw new NotImplementedException ("offsets in switch statements.");
+                                                throw new InternalErrorException ("offsets in switch statements.");
                                         }
                                 }
                         } else {