Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TryBlock.cs « codegen « ilasm « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9ec09d7a23b0c7ef616245bdb18fb5e2f0c7bc72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// Mono.ILASM.TryBlock
//
// Author(s):
//  Jackson Harper (Jackson@LatitudeGeo.com)
//
// (C) 2003 Jackson Harper, All rights reserved
//


using System;
using System.Collections;

namespace Mono.ILASM {

        public class TryBlock : IInstr {

                private HandlerBlock block;
                private ArrayList clause_list;

                public TryBlock (HandlerBlock block, Location loc)
			: base (loc)
                {
			this.block = block;
			clause_list = new ArrayList ();
                }

                public void AddSehClause (ISehClause clause)
                {
                        clause_list.Add (clause);
                }

                public override void Emit (CodeGen code_gen, MethodDef meth,
					   PEAPI.CILInstructions cil)
                {
                        PEAPI.CILLabel from = block.GetFromLabel (code_gen, meth);
                        PEAPI.CILLabel to = block.GetToLabel (code_gen, meth);
                        PEAPI.TryBlock try_block = new PEAPI.TryBlock (from, to);

                        foreach (ISehClause clause in clause_list)
                                try_block.AddHandler (clause.Resolve (code_gen, meth));
			
                        cil.AddTryBlock (try_block);
                }

        }

}