The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
CastExpression.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: CastExpression.cs //
6 // Author: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Description: //
8 // Encapsulates a cast expression. //
9 // Inheritance: Expression. //
10 // Implements Composite pattern [Composite]. //
11 // Implements Visitor pattern [Concrete Element]. //
12 // -------------------------------------------------------------------------- //
13 // Create date: 07-12-2006 //
14 // Modification date: 21-03-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 CastExpression : Expression
36  {
37  #region Fields
38 
42  private TypeExpression type;
43 
47  private string castTypeId;
48 
52  private Expression expression;
53 
54  #endregion
55 
56  #region Properties
57 
62  {
63  get { return this.type; }
64  set { this.type = value; }
65  }
66 
70  public string CastId
71  {
72  get { return this.castTypeId; }
73  }
74 
78  public Expression Expression
79  {
80  get { return this.expression; }
81  set { this.expression = value; }
82  }
83 
84  #endregion
85 
86  #region Constructor
87 
96  public CastExpression(string castType, Expression exp, Location location) : base(location)
97  {
98  this.castTypeId = castType;
99  this.expression = exp;
100  }
101 
102  #endregion
103 
104  #region Accept()
105 
112  public override Object Accept(Visitor v, Object o)
113  {
114  return v.Visit(this, o);
115  }
116 
117  #endregion
118  }
119 }
Abstract class encapsulate a programming language expression.
Definition: Expression.cs:37
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
Encapsulates a cast expression.
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 that represents all different types.
string CastId
Gets the cast identifier.
CastExpression(string castType, Expression exp, Location location)
Constructor of CastExpression
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39
TypeExpression CastType
Gets or sets the type to convert the expression