4 using DynVarManagement;
5 using TypeSystem.Constraints;
7 namespace TypeSystem.Operations {
23 this.unaryOperator = unaryOperator;
24 this.methodAnalyzed = methodAnalyzed;
25 this.showErrorMessage = showErrorMessage;
26 this.location = location;
32 return operand.FieldTypeExpression.AcceptOperation(
this, arg);
36 #region +- PropertyType
38 return operand.PropertyTypeExpression.AcceptOperation(
this, arg);
42 #region +- TypeVariable
45 DynVarOptions.Instance.AssignDynamism(operand.Substitution, operand.IsDynamic);
46 return operand.Substitution.AcceptOperation(
this, arg);
48 if (methodAnalyzed != null) {
51 methodAnalyzed.AddConstraint(constraint);
52 return constraint.ReturnType;
54 return ReportError(operand);
65 methodAnalyzed.AddConstraint(constraint);
66 return constraint.ReturnType;
74 returnType = UnionType.collect(returnType, ret);
77 if (showErrorMessage && operand.IsDynamic && returnType == null)
78 ErrorManager.Instance.NotifyError(
new NoTypeAcceptsOperation(operand.FullName, unaryOperator.ToString(), location));
86 return ReportError(operand);
112 #region Report Errors
116 if (this.showErrorMessage)
117 ErrorManager.Instance.NotifyError(
new OperationNotAllowedError(this.unaryOperator.ToString(), tE.FullName, this.location));
static CharType Instance
Gets the unique instance of CharType
Represents a error produced when tries to make an operation not allowed for the specified type...
static DoubleType Instance
Gets the unique instance of DoubleType
override object Exec(CharType operand, object arg)
override object Exec(FieldType operand, object arg)
override object Exec(BoolType operand, object arg)
UnaryArithmeticalOperation(UnaryOperator unaryOperator, MethodType methodAnalyzed, bool showErrorMessage, Location location)
override object Exec(PropertyType operand, 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.
Class Unary AritmethicalOperation Implements: Factory method Role:
override object Exec(DoubleType operand, object arg)
override object ReportError(TypeExpression tE)
UnaryOperator unaryOperator
MethodType methodAnalyzed
Represent a character type.
Abstract class that represents all different types.
Represents a generic type expression
Represent a integer type.
override object Exec(TypeVariable operand, object arg)
Represents a double type.
virtual bool IsDynamic
Indicates if the type has been set as dynamic
UnaryOperator
Unary operators
This class instantiates elements of type UnaryArithmeticalOperation, and BinaryArithmeticalOperation...
override bool IsFreshVariable()
To know if it is a type variable with no substitution
Representa a property type.
Representa a method type.
It represents constraints of the form: ret := op1 op op2 Where op is an arithmetic operator ...
static IntType Instance
Gets the unique instance of IntType
override object Exec(IntType operand, object arg)
TypeExpression Substitution
Gets the substitution; null if it does not exist
static ArithmeticalOperation Create(UnaryOperator unaryOperator, MethodType methodAnalyzed, bool showErrorMessage, Location location)
A factory Method to create UnaryAritmeticaslOperation objects Implements a factory method...
override object Exec(UnionType operand, object arg)
Represents a error produced when a dynamic union type has no valid type to be applied an operation ...
virtual object AcceptOperation(TypeSystemOperation op, object arg)