2 // Mono.ILASM.SwitchInstr
5 // Jackson Harper (Jackson@LatitudeGeo.com)
7 // (C) 2003 Jackson Harper, All rights reserved
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
)
23 this.label_list
= label_list
;
26 public override void Emit (CodeGen code_gen
, MethodDef meth
,
27 PEAPI
.CILInstructions cil
)
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 LabelInfo
) {
36 label_array
[count
++] = ((LabelInfo
)lab
).Label
;
38 throw new InternalErrorException ("offsets in switch statements.");
42 label_array
= new PEAPI
.CILLabel
[0];
45 cil
.Switch (label_array
);