The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
FieldAccessExpression.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: FieldAccessExpression.cs //
6 // Author: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Description: //
8 // Encapsulates the expression to access a field. //
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 using TypeSystem.Operations;
25 using AST.Operations;
26 
27 namespace AST
28 {
38  {
39  #region Fields
40 
44  private Expression expression;
45 
49  private SingleIdentifierExpression field;
50 
51 
55  private bool typeInferredInVisitorTypeDefinition = false;
56 
57  #endregion
58 
59  #region Properties
60 
64  public Expression Expression
65  {
66  get { return this.expression; }
67  set { this.expression = value; }
68  }
69 
74  {
75  get { return this.field; }
76  }
77 
82  get { return typeInferredInVisitorTypeDefinition; }
83  set { typeInferredInVisitorTypeDefinition = value; }
84  }
85 
92  get { return this.frozenTypeExpression; }
93  set { this.frozenTypeExpression = value; }
94  }
95  #endregion
96 
97  #region Constructor
98 
108  : base(location)
109  {
110  this.expression = exp;
111  this.field = fieldName;
112  }
113 
114  #endregion
115 
116  #region Accept()
117 
124  public override Object Accept(Visitor v, Object o)
125  {
126  return v.Visit(this, o);
127  }
128 
129  #endregion
130 
131  #region Dispatcher AstOperation
132  public override object AcceptOperation(AstOperation op, object arg) {
140  return op.Exec(this, arg);
141  }
142 
143  #endregion
144  }
145 }
bool TypeInferredInVisitorTypeDefinition
To know if the visitor type definition has already inferred a type
Abstract class encapsulate a programming language expression.
Definition: Expression.cs:37
TypeExpression FrozenTypeExpression
WriteType variable may change its type's substitution (e.g., field type variables) This attribute sav...
Encapsulates the expression to access a field.
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
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
FieldAccessExpression(Expression exp, SingleIdentifierExpression fieldName, Location location)
Constructor of FieldAccessExpression
This class represent the entry wnen sending a message to an operation object. derived from AstNode ...
Abstract class that represents all different types.
override object AcceptOperation(AstOperation op, object arg)
Dispatches expressions to the operation passed as argument. It provokes the execution of op...
Encapsulates a identifier expression of our programming language.
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39
SingleIdentifierExpression FieldName
Gets the name to the field.