The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
NewExpression.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: NewExpression.cs //
6 // Author: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Description: //
8 // Encapsulates a new expression. //
9 // Inheritance: BaseCallExpression. //
10 // Implements Composite pattern [Composite]. //
11 // Implements Visitor pattern [Concrete Element]. //
12 // -------------------------------------------------------------------------- //
13 // Create date: 07-12-2006 //
14 // Modification date: 01-01-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 AST.Operations;
25 
26 namespace AST
27 {
37  {
38  #region Fields
39 
43  private string typeInfo;
44 
48  private TypeExpression newType;
49 
50  #endregion
51 
52  #region Properties
53 
57  public string TypeInfo
58  {
59  get { return this.typeInfo; }
60  }
61 
66  get { return this.newType; }
67  set { this.newType = value; }
68  }
69 
70  #endregion
71 
72  #region Constructor
73 
82  public NewExpression(string type, CompoundExpression arguments, Location location)
83  : base(arguments, location)
84  {
85  this.typeInfo = type;
86  }
87 
88  #endregion
89 
90  #region Accept()
91 
98  public override Object Accept(Visitor v, Object o)
99  {
100  return v.Visit(this, o);
101  }
102 
103  #endregion
104 
105  #region Dispatcher AstOperation
106  public override object AcceptOperation(AstOperation op, object arg) {
114  return op.Exec(this, arg);
115  }
116 
117  #endregion
118  }
119 }
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...
TypeExpression NewType
This class represent the entry wnen sending a message to an operation object. derived from AstNode ...
Abstract class that represents all different types.
NewExpression(string type, CompoundExpression arguments, Location location)
Constructor of NewExpression
Encapsulates a set of expressions.
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39
string TypeInfo
Gets the name of the new type
Encapsulates a invocation expression to base class.
Encapsulates a new expression.