Inference/src/TypeSystem/Operations/CastOperation.cs
/// <summary>
/// If the from:TypeVariable has substitution the exec method whi this scope of variables is invoked.
/// If the cast is possible it returns the value of the field "to". If there is an error and showMessages
/// is true an error is raised, and a CastConstraint is added, depending the value of showMessages and methodAnalyzed.
/// 
/// </summary>
/// <param name="from">The type from we want to cast.</param>
/// <returns>The TypeExpression castType if the casting is possible. Otherwise. If there is an error and showMessages
/// is true, an error is raised.</returns>
If the from:TypeVariable has substitution the exec method whi this scope of variables is invoked.
If the cast is possible it returns the value of the field "to". If there is an error and showMessages
is true an error is raised, and a CastConstraint is added, depending the value of showMessages and methodAnalyzed.
If the from : TypeVariable has substitution the exec method whi this scope of variables is invoked . If the cast is possible it returns the value of the field " to " . If there is an error and showMessages is true an error is raised and a CastConstraint is added depending the value of showMessages and methodAnalyzed .
public override object Exec(TypeVariable from, object arg) {
            if (from.Substitution != null) {
                return from.Substitution.AcceptOperation(this, arg);
            }
            if (this.methodAnalyzed != null) {
                CastConstraint constraint = new CastConstraint(from, this.castType, this.location);
                this.methodAnalyzed.AddConstraint(constraint);
                return constraint.ReturnType;
            }
            return ReportError(from);
        }
public override object Exec ( TypeVariable from , object arg ) { if ( from . Substitution != null ) { return from . Substitution . AcceptOperation ( this , arg ) ; } if ( this . methodAnalyzed != null ) { CastConstraint constraint = new CastConstraint ( from , this . castType , this . location ) ; this . methodAnalyzed . AddConstraint ( constraint ) ; return constraint . ReturnType ; } return ReportError ( from ) ; }
If the from:TypeVariable has substitution the exec method whi this scope of variables is invoked.
If the from : TypeVariable has substitution the exec method whi this scope of variables is invoked .
// * A constraint is added to the method analyzed
The TypeExpression castType if the casting is possible. Otherwise. If there is an error and showMessages
is true, an error is raised.
The TypeExpression castType if the casting is possible . Otherwise . If there is an error and showMessages is true an error is raised .
from
TypeVariable
The type from we want to cast.
The type from we want to cast .
arg
object