The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
ExceptionManagementStatement.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: ExceptionManagementStatement.cs //
6 // Author: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Description: //
8 // Encapsulates a Try-Catch statement of our programming languages. //
9 // Inheritance: Statement. //
10 // Implements Composite pattern [Composite]. //
11 // Implements Visitor pattern [Concrete Element]. //
12 // -------------------------------------------------------------------------- //
13 // Create date: 05-12-2006 //
14 // Modification date: 12-12-2006 //
16 
17 
18 using System;
19 using System.Collections.Generic;
20 using System.Text;
21 using System.Collections;
22 using System.Collections.ObjectModel;
23 using System.Diagnostics;
24 using System.Reflection;
25 using Tools;
26 using ErrorManagement;
27 
28 
29 namespace AST
30 {
41  {
42  #region Fields
43 
47  private Block tryBlock;
48 
52  private List<CatchStatement> catchStatements;
53 
57  private Block finallyBlock;
58 
59  #endregion
60 
61  #region Properties
62 
66  public Block TryBlock
67  {
68  get { return this.tryBlock; }
69  set { this.tryBlock = value;}
70  }
71 
76  public Block FinallyBlock
77  {
78  get { return this.finallyBlock; }
79  set { this.finallyBlock = value; }
80  }
81 
85  public int CatchCount
86  {
87  get { return this.catchStatements.Count; }
88  }
89 
90  #endregion
91 
92  #region Constructor
93 
100  public ExceptionManagementStatement(Block tryBlock, List<CatchStatement> catchStatements, Block finallyBlock, Location location)
101  : base(location) {
102  this.tryBlock = tryBlock;
103  this.catchStatements = catchStatements;
104  this.finallyBlock = finallyBlock;
105  }
106 
107  #endregion
108 
109 
110  #region GetCatchElement()
111 
117  public CatchStatement GetCatchElement(int index)
118  {
119  return this.catchStatements[index];
120  }
121 
122  #endregion
123 
124  #region Accept()
125 
132  public override Object Accept(Visitor v, Object o)
133  {
134  return v.Visit(this, o);
135  }
136 
137  #endregion
138  }
139 }
Encapsulates a block of statements.
Definition: Block.cs:34
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
Encapsulates a Catch statement of our programming languages.
Abstract class to define different visits over the abstract syntax tree.
Definition: Visitor.cs:29
This class encapsulates a location in a specific file. Implements an Inmutable pattern. So it can be used in any context, that is his internal fields never change.
Definition: Location.cs:24
Abstract class represents a programming language statement.
Definition: Statement.cs:30
CatchStatement GetCatchElement(int index)
Gets the element stored in the specified index.
Block TryBlock
Gets the statements executed in Try block.
int CatchCount
Gets the number of catch blocks.
Encapsulates a Try-Catch-finally statement of our programming languages. As C# states catch blcok and...
ExceptionManagementStatement(Block tryBlock, List< CatchStatement > catchStatements, Block finallyBlock, Location location)
Constructor of ExceptionManagementStatement
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39
Block FinallyBlock
Gets the statements executed in Finally block. if there is no finally statementes can be null ...