The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
IsExpression.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: IsExpression.cs //
6 // Author: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Description: //
8 // Encapsulates a Is 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: 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 IsExpression : Expression
36  {
37  #region Fields
38 
42  private Expression expr;
43 
47  private TypeExpression type;
48 
52  private string typeId;
53 
54  #endregion
55 
56  #region Properties
57 
61  public Expression Expression
62  {
63  get { return this.expr; }
64  set { this.expr = value; }
65  }
66 
71  {
72  get { return this.type; }
73  set { this.type = value; }
74  }
75 
79  public string TypeId
80  {
81  get { return this.typeId; }
82  }
83 
84  #endregion
85 
86  #region Constructor
87 
96  public IsExpression(Expression expression, string type, Location loc)
97  : base(loc)
98  {
99  this.expr = expression;
100  this.typeId = type;
101  }
102 
103  #endregion
104 
105  #region Accept()
106 
113  public override Object Accept(Visitor v, Object o)
114  {
115  return v.Visit(this, o);
116  }
117 
118  #endregion
119  }
120 }
Abstract class encapsulate a programming language expression.
Definition: Expression.cs:37
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 TypeId
Gets the type identifier to check with the expression.
Definition: IsExpression.cs:80
Encapsulates a Is expression.
Definition: IsExpression.cs:35
TypeExpression TypeExpr
Gets the type to check with the expression.
Definition: IsExpression.cs:71
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
IsExpression(Expression expression, string type, Location loc)
Constructor of IsExpression
Definition: IsExpression.cs:96