Inference/src/TypeSystem/Operations/CastOperation.cs
/// <summary>
/// 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.
/// </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 cast is possible it returns the value of the field "to". If there is an error and showMessages is true an error is raised.
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 .
public override object Exec(TypeExpression from, object arg) {
            if (this.castType == null)
                return null;
            if (((int)castType.AcceptOperation(new PromotionLevelOperation(from), arg) != -1) || ((int)from.AcceptOperation(new PromotionLevelOperation(castType), arg) != -1))
                return castType;
            return ReportError(from);
        }
public override object Exec ( TypeExpression from , object arg ) { if ( this . castType == null ) return null ; if ( ( ( int ) castType . AcceptOperation ( new PromotionLevelOperation ( from ) , arg ) != - 1 ) || ( ( int ) from . AcceptOperation ( new PromotionLevelOperation ( castType ) , arg ) != - 1 ) ) return castType ; return ReportError ( from ) ; }
If the cast is possible it returns the value of the field "to".
If the cast is possible it returns the value of the field " to " .
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
TypeExpression
The type from we want to cast.
The type from we want to cast .
arg
object