codegen: Limit scope of locals freed on errors thrown from catch clauses
[vala-lang.git] / vala / valastatementlist.vala
blob934227a1a7485f1e9d712b29fedee5cc9a5cbb44
1 /* valastatementlist.vala
3 * Copyright (C) 2008-2010 Jürg Billeter
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author:
20 * Jürg Billeter <j@bitron.ch>
24 public class Vala.StatementList : CodeNode, Statement {
25 private List<Statement> list = new ArrayList<Statement> ();
27 public int length {
28 get { return list.size; }
31 public StatementList (SourceReference source_reference) {
32 this.source_reference = source_reference;
35 public Statement get (int index) {
36 return list.get (index);
39 public void set (int index, Statement stmt) {
40 list.set (index, stmt);
43 public void add (Statement stmt) {
44 list.add (stmt);
47 public void insert (int index, Statement stmt) {
48 list.insert (index, stmt);
51 public override void accept (CodeVisitor visitor) {
52 foreach (Statement stmt in list) {
53 stmt.accept (visitor);
57 public override void emit (CodeGenerator codegen) {
58 foreach (Statement stmt in list) {
59 stmt.emit (codegen);