5 using TypeSystem.Constraints;
6 using DynVarManagement;
8 namespace TypeSystem.Operations {
13 public class SquareBracketOperation : TypeSystemOperation {
18 protected bool showErrorMessage;
25 this.methodAnalyzed = methodAnalyzed;
26 this.showErrorMessage = showErrorMessage;
27 this.location = location;
36 return a.ArrayTypeExpression;
41 #region TypeVariable []
45 if (subtitutions != null) {
46 DynVarOptions.Instance.AssignDynamism(subtitutions, a.IsDynamic);
47 return subtitutions.AcceptOperation(
this, arg);
49 if (this.methodAnalyzed != null) {
52 this.methodAnalyzed.AddConstraint(bracketConstraint);
55 return bracketConstraint.ReturnType;
58 return ReportError(a);
62 #region PropertyType []
65 return a.PropertyTypeExpression.AcceptOperation(
this, arg);
70 #region BCLClassType []
74 return TypeTable.Instance.GetType(a.TypeInfo.GetElementType().FullName, this.location);
76 if (a.
Methods.ContainsKey(
"get_Item")) {
82 return ReportError(a);
92 this.methodAnalyzed.AddConstraint(constraint);
93 return constraint.ReturnType;
101 returnType = UnionType.collect(returnType, ret);
111 return a.FieldTypeExpression.AcceptOperation(
this, arg);
117 #region Report Errors
123 if (this.showErrorMessage)
Represents a error produced when tries to make an operation not allowed for the specified type...
override object Exec(TypeVariable a, object arg)
Representa an array type.
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(BCLClassType a, object arg)
Dictionary< string, AccessModifier > Methods
Gets the method list
ArrayOperator
Array operators
Abstract class that represents all different types.
Represents a generic type expression
override object Exec(ArrayType a, object arg)
virtual string FullName
Gets the full name of the type Note: WriteType expression is the longest recursive representation of ...
int ParameterListCount
Gets the number of parameters
Represent a integer type.
Type TypeInfo
Returns the real introspective type
SquareBracketOperation(TypeExpression index, MethodType methodAnalyzed, bool showErrorMessage, Location location)
override object ReportError(TypeExpression tE)
override object Exec(PropertyType a, object arg)
Implements bracket operation of a type expression. Implments double dispatcher pattern.
TypeExpression FieldTypeExpression
Gets the field type.
virtual bool IsDynamic
Indicates if the type has been set as dynamic
override object Exec(UnionType a, object arg)
override bool IsFreshVariable()
To know if it is a type variable with no substitution
Representa a property type.
Representa a method type.
static IntType Instance
Gets the unique instance of IntType
It represents constraints of the form: ret := ret := op1 [ op2 ]
TypeExpression PropertyTypeExpression
Gets the property type.
virtual object AcceptOperation(TypeSystemOperation op, object arg)
override object Exec(FieldType a, object arg)