(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / ilasm / codegen / SwitchInstr.cs
blob25dbfbac3f34233eb0e8612fe7596e78eb9c9be1
1 //
2 // Mono.ILASM.SwitchInstr
3 //
4 // Author(s):
5 // Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
11 using System;
12 using System.Collections;
14 namespace Mono.ILASM {
16 public class SwitchInstr : IInstr {
18 private ArrayList label_list;
20 public SwitchInstr (ArrayList label_list, Location loc)
21 : base (loc)
23 this.label_list = label_list;
26 public override void Emit (CodeGen code_gen, MethodDef meth,
27 PEAPI.CILInstructions cil)
29 int count = 0;
30 PEAPI.CILLabel[] label_array;
32 if (label_list != null) {
33 label_array = new PEAPI.CILLabel[label_list.Count];
34 foreach (object lab in label_list) {
35 if (lab is string) {
36 label_array[count++] = meth.GetLabelDef ((string) lab);
37 } else {
38 throw new NotImplementedException ("offsets in switch statements.");
41 } else {
42 label_array = new PEAPI.CILLabel [0];
45 cil.Switch (label_array);