The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
IdDeclaration.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: IdDeclaration.cs //
6 // Author: Cristina Gonzalez Mu�oz - cristi.gm@gmail.com //
7 // Description: //
8 // Encapsulates a declaration. //
9 // Inheritance: Declaration. //
10 // Implements Composite pattern [Composite]. //
11 // Implements Visitor pattern [Concrete Element]. //
12 // -------------------------------------------------------------------------- //
13 // Create date: 04-01-2007 //
14 // Modification date: 12-06-2007 //
16 
17 using System;
18 using System.Collections.Generic;
19 using System.Text;
20 
21 using Tools;
22 using TypeSystem;
23 using Symbols;
24 using ErrorManagement;
25 using AST.Operations;
26 namespace AST
27 {
36  public class IdDeclaration : Declaration
37  {
38  #region Fields
39 
43  private SingleIdentifierExpression identifier;
44 
48  private Symbol symbol;
49 
50  #endregion
51 
52  #region Properties
53 
57  public string Identifier
58  {
59  get { return this.identifier.Identifier; }
60  }
61 
65  public string ILName
66  {
67  get { return this.IdentifierExp.ILName; }
68  }
69 
74  {
75  get { return this.identifier; }
76  }
77 
81  public Symbol Symbol {
82  get { return symbol; }
83  set { symbol = value; }
84  }
85 
86  #endregion
87 
88  #region Constructor
89 
99  : base(type, location)
100  {
101  this.identifier = id;
102  this.identifier.IndexOfSSA = 0;
103  }
104 
114  public IdDeclaration(SingleIdentifierExpression id, int indexSSA, string type, Location location)
115  : base(type, location)
116  {
117  this.identifier = id;
118  this.identifier.IndexOfSSA = indexSSA;
119  }
120 
121  #endregion
122 
123  #region Accept()
124 
131  public override Object Accept(Visitor v, Object o)
132  {
133  return v.Visit(this, o);
134  }
135 
136  #endregion
137 
138  #region Dispatcher AstOperation
139  public override object AcceptOperation(AstOperation op, object arg) {
147  return op.Exec(this, arg);
148  }
149 
150  #endregion
151  }
152 }
string ILName
Gets the IL name associated to the declaration identifier.
IdDeclaration(SingleIdentifierExpression id, string type, Location location)
Constructor of IdDeclaration
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
override object AcceptOperation(AstOperation op, object arg)
Dispatches expressions to the operation passed as argument. It provokes the execution of op...
This class represent the entry wnen sending a message to an operation object. derived from AstNode ...
This class represents a symbol associated with its identifier.
Definition: Symbol.cs:26
Encapsulates a identifier expression of our programming language.
SingleIdentifierExpression IdentifierExp
Gets the identifier expression
Encapsulates a declaration of a concrete type.
Definition: Declaration.cs:34
Encapsulates a declaration.
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39
IdDeclaration(SingleIdentifierExpression id, int indexSSA, string type, Location location)
Constructor of IdDeclaration
string Identifier
Gets the name associated to the declaration
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.