4 using DynVarManagement;
5 using TypeSystem.Constraints;
6 using System.Collections.Generic;
8 namespace TypeSystem.Operations {
23 get {
return DotKind.Constrained; }
27 protected string memberName;
56 this.memberName = memberName;
57 this.methodAnalyzed = methodAnalyzed;
58 this.previousDot = previousDot;
64 #region arrayType.member
72 return d.AsClassType().AcceptOperation(
this, arg);
76 #region BCLClassType.member
77 public override object Exec(
BCLClassType d,
object arg) {
87 ErrorManager.Instance.NotifyError(
new UnknownMemberError(this.memberName, this.location));
92 #region BoolType.member
102 return d.AsClassType().AcceptOperation(
this, arg);
106 #region CharType.member
108 return d.AsClassType().AcceptOperation(
this, arg);
112 #region ClassType.member
115 if (member == null) {
116 ErrorManager.Instance.NotifyError(
new UnknownMemberError(this.memberName, this.location));
127 #region ClassTypeProxy.member
129 return d.RealType.AcceptOperation(
this, arg);
133 #region Double.member
135 return d.AsClassType().AcceptOperation(
this, arg);
139 #region FieldType.member
145 if (unionType != null)
146 DynVarOptions.Instance.AssignDynamism(d.FieldTypeExpression, d.IsDynamic);
147 return d.FieldTypeExpression.AcceptOperation(
this, arg);
153 #region IntType.member
155 return d.AsClassType().AcceptOperation(
this, arg);
159 #region Property.member
162 return d.PropertyTypeExpression.AcceptOperation(
this, arg);
167 #region String.member
169 return d.AsClassType().AcceptOperation(
this, arg);
173 #region TypeExpression.member
175 return ReportError(d);
179 #region InterfaceType.member
182 UnconstrainedDotOperation uo =
new UnconstrainedDotOperation(this.memberName, this.previousDot);
186 ErrorManager.Instance.NotifyError(
new UnknownMemberError(this.memberName, this.location));
192 #region TypeVariable.member
195 DynVarOptions.Instance.AssignDynamism(d.Substitution, d.IsDynamic);
196 return d.Substitution.AcceptOperation(
this, arg);
198 if (methodAnalyzed != null) {
201 methodAnalyzed.AddConstraint(constraint);
202 return constraint.ReturnType;
209 #region UnionType.member
212 if (previousDot.Contains(d))
220 methodAnalyzed.AddConstraint(constraint);
221 return constraint.ReturnType;
236 returnType = UnionType.collect(returnType, ret);
239 if (returnType == null)
245 #region Report Errors
256 if (this.showErrorMessage)
bool validAccess(TypeExpression member)
Validates the correct access to members, taking into account the information hiding level...
override object Exec(ClassType d, object arg)
This class generatess constraits, and raises error if something is wrong. Implements a double dispatc...
override object AcceptOperation(TypeSystemOperation op, object arg)
override string FullName
The full name in type variables is calculated just in time
Represents a error produced when tries to make an operation not allowed for the specified type...
Representa an array type.
override object Exec(InterfaceType d, object arg)
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.
override object Exec(PropertyType d, object arg)
override object Exec(BoolType d, object arg)
Delegate its behaviour to the BCLClassType, chaining its message to the later.
override object Exec(ArrayType d, object arg)
Delegate its behaviour to the BCLClassType, chaining its message to the later.
override object Exec(TypeExpression d, object arg)
Represents a interface type.
Represent a character type.
override object Exec(DoubleType d, object arg)
Abstract class that represents all different types.
Represents a generic type expression
Represents a proxy of a class type. It implements the unfold operatations of theoretical type systes...
virtual string FullName
Gets the full name of the type Note: WriteType expression is the longest recursive representation of ...
override object ReportError(TypeExpression tE)
If showMessages is true it raises and error. It returns null
Implements a factory method pattern. Virtual constructor. Role: factory Implements a double dispatche...
Represent a integer type.
override object Exec(IntType d, object arg)
Location location
The location (file, line, column) of text being analyzed.
Represents a double type.
TypeExpression FieldTypeExpression
Gets the field type.
override object Exec(ClassTypeProxy d, object arg)
virtual bool IsDynamic
Indicates if the type has been set as dynamic
MethodType methodAnalyzed
The method that is being analyzed when the operation is performed.
Represents a error produced when a dynamic union type has no valid type to be applied an operation ...
override bool IsFreshVariable()
To know if it is a type variable with no substitution
Representa a property type.
Representa a method type.
override object AcceptOperation(TypeSystemOperation op, object arg)
override object Exec(CharType d, object arg)
override object Exec(TypeVariable d, object arg)
TypeExpression Substitution
Gets the substitution; null if it does not exist
Represents a error produced when a member cannot be access due to its protection level.
TypeExpression PropertyTypeExpression
Gets the property type.
IList< TypeExpression > previousDot
To detect infinite loops. The types that have been previously passed the dot message. Used for union types.
override object AcceptOperation(TypeSystemOperation op, object arg)
Represents a error produced when the attribute identifier is not defined.
override object Exec(UnionType d, object arg)
virtual object AcceptOperation(TypeSystemOperation op, object arg)
override object Exec(StringType d, object arg)
It represents constraints of the form: ret := op1 . memberName
override object Exec(FieldType d, object arg)