The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
Definition.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: Definition.cs //
6 // Author: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Description: //
8 // Encapsulates a definition. //
9 // Inheritance: IdDeclaration. //
10 // Implements Composite pattern [Composite]. //
11 // Implements Visitor pattern [Concrete Element]. //
12 // -------------------------------------------------------------------------- //
13 // Create date: 07-12-2006 //
14 // Modification date: 01-02-2006 //
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 AST.Operations;
25 
26 namespace AST
27 {
36  public class Definition : IdDeclaration
37  {
38  #region Fields
39 
43  private Expression initialization;
44 
45  #endregion
46 
47  #region Properties
48 
52  public Expression Init
53  {
54  get { return this.initialization; }
55  }
56 
63  {
64  get { return this.frozenTypeExpression; }
65  set { this.frozenTypeExpression = value; }
66  }
67 
68  #endregion
69 
70  #region Constructor
71 
82  : base(id, type, location)
83  {
84  this.initialization = init;
85  }
86 
97  public Definition(SingleIdentifierExpression id, string type, Expression init, int indexSSA, Location location)
98  : base(id, indexSSA, type, location)
99  {
100  this.initialization = init;
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  #region Dispatcher AstOperation
121  public override object AcceptOperation(AstOperation op, object arg) {
129  return op.Exec(this, arg);
130  }
131 
132  #endregion
133  }
134 }
Abstract class encapsulate a programming language expression.
Definition: Expression.cs:37
Definition(SingleIdentifierExpression id, string type, Expression init, int indexSSA, Location location)
Constructor of Definition
Definition: Definition.cs:97
Expression Init
Gets the initialization of the definition
Definition: Definition.cs:53
TypeExpression FrozenTypeExpression
WriteType variable may change its type's substitution (e.g., field type variables) This attribute sav...
Definition: Definition.cs:63
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
Encapsulates a definition.
Definition: Definition.cs:36
This class represent the entry wnen sending a message to an operation object. derived from AstNode ...
Abstract class that represents all different types.
Encapsulates a identifier expression of our programming language.
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
Definition: Definition.cs:113
Encapsulates a declaration.
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39
override object AcceptOperation(AstOperation op, object arg)
Dispatches expressions to the operation passed as argument. It provokes the execution of op...
Definition: Definition.cs:128
Definition(SingleIdentifierExpression id, string type, Expression init, Location location)
Constructor of Definition.
Definition: Definition.cs:81