The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
ReturnStatement.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: ReturnStatement.cs //
6 // Author: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Description: //
8 // Encapsulates a Return 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: 25-04-2007 //
16 
17 using System;
18 using System.Collections.Generic;
19 using System.Text;
20 
21 using Tools;
22 using TypeSystem;
23 using ErrorManagement;
24 
25 namespace AST
26 {
35  public class ReturnStatement : Statement
36  {
37  #region Fields
38 
42  private Expression returnExpression;
43 
47  private Block assigns;
48 
52  private MethodType currentMethodType;
53  #endregion
54 
55  #region Properties
56 
61  {
62  get { return this.returnExpression; }
63  set { this.returnExpression = value; }
64  }
65 
69  public Block Assigns
70  {
71  get { return this.assigns; }
72  }
73 
78  get { return this.currentMethodType; }
79  set { this.currentMethodType= value; }
80  }
81  #endregion
82 
83  #region Constructor
84 
93  : base(location)
94  {
95  this.returnExpression = returnExp;
96  this.assigns = new Block(this.Location);
97  }
98 
99  #endregion
100 
101  #region Accept()
102 
109  public override Object Accept(Visitor v, Object o)
110  {
111  return v.Visit(this, o);
112  }
113 
114  #endregion
115  }
116 }
Encapsulates a Return statement of our programming languages.
MethodType CurrentMethodType
The method where the return statement appears
Abstract class encapsulate a programming language expression.
Definition: Expression.cs:37
Encapsulates a block of statements.
Definition: Block.cs:34
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
Block Assigns
Gets the assignment statements.
ReturnStatement(Expression returnExp, Location location)
Constructor of ReturnStatement
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39
Expression ReturnExpression
Gets the return expression.
Representa a method type.
Definition: MethodType.cs:37
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.