The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
Declaration.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: Declaration.cs //
6 // Author: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Description: //
8 // Encapsulates a declaration of a concrete type. //
9 // Inheritance: Statement. //
10 // Implements Composite pattern [Composite]. //
11 // Implements Visitor pattern [Concrete Element]. //
12 // -------------------------------------------------------------------------- //
13 // Create date: 07-12-2006 //
14 // Modification date: 01-02-2007 //
16 
17 using System;
18 using System.Collections.Generic;
19 using System.Text;
20 using Tools;
21 using TypeSystem;
22 using ErrorManagement;
23 using AST.Operations;
24 namespace AST
25 {
34  public abstract class Declaration : Statement
35  {
36  #region Fields
37 
41  private TypeExpression type = null;
42 
46  private string fullName = "";
47 
54 
55  #endregion
56 
57  #region Properties
58 
63  {
64  get { return this.type; }
65  set { this.type = value; }
66  }
67 
71  public string FullName
72  {
73  get { return this.fullName; }
74  set { this.fullName = value; }
75  }
76 
80  public virtual TypeExpression ILTypeExpression
81  {
82  get
83  {
84  if (this.frozenTypeExpression != null)
85  return this.frozenTypeExpression;
86  else
87  return this.type;
88  }
89  }
90 
91 
92  #endregion
93 
94  #region Constructor
95 
103  protected Declaration(string type, Location location): base(location)
104  {
105  this.fullName = type;
106  }
107  #endregion
108 
109  #region Dispatcher AstOperation
110  public override object AcceptOperation(AstOperation op, object arg) {
118  return op.Exec(this, arg);
119  }
120  #endregion
121  }
122 }
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 represents a programming language statement.
Definition: Statement.cs:30
TypeExpression frozenTypeExpression
WriteType variable may change its type's substitution (e.g., field type variables) This attribute sav...
Definition: Declaration.cs:53
Declaration(string type, Location location)
Constructor of Declaration
Definition: Declaration.cs:103
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...
Definition: Declaration.cs:117
Encapsulates a declaration of a concrete type.
Definition: Declaration.cs:34
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39
string FullName
Gets or sets the nominal type of the declaration
Definition: Declaration.cs:72
TypeExpression TypeExpr
Gets or sets the type of the declaration
Definition: Declaration.cs:63
virtual TypeExpression ILTypeExpression
Gets the type expression to use in code generation.
Definition: Declaration.cs:81