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 TryBlock
: IInstr
{
18 private HandlerBlock block
;
19 private ArrayList clause_list
;
21 public TryBlock (HandlerBlock block
, Location loc
)
25 clause_list
= new ArrayList ();
28 public void AddSehClause (ISehClause clause
)
30 clause_list
.Add (clause
);
33 public override void Emit (CodeGen code_gen
, MethodDef meth
,
34 PEAPI
.CILInstructions cil
)
36 PEAPI
.CILLabel
from = block
.GetFromLabel (code_gen
, meth
);
37 PEAPI
.CILLabel to
= block
.GetToLabel (code_gen
, meth
);
38 PEAPI
.TryBlock try_block
= new PEAPI
.TryBlock (from, to
);
40 foreach (ISehClause clause
in clause_list
)
41 try_block
.AddHandler (clause
.Resolve (code_gen
, meth
));
43 cil
.AddTryBlock (try_block
);