Boo.Lang.Compiler.Steps.ProcessMethodBodies.LeaveCastExpression C# (CSharp) Метод

LeaveCastExpression() публичный Метод

public LeaveCastExpression ( Boo.Lang.Compiler.Ast.CastExpression node ) : void
node Boo.Lang.Compiler.Ast.CastExpression
Результат void
        public override void LeaveCastExpression(CastExpression node)
        {
            var fromType = GetExpressionType(node.Target);
            var toType = GetType(node.Type);
            BindExpressionType(node, toType);

            if (IsError(fromType) || IsError(toType))
                return;

            if (IsAssignableFrom(toType, fromType))
                return;

            if (TypeSystemServices.CanBeReachedByPromotion(toType, fromType))
                return;

            if (TypeSystemServices.IsFloatingPointNumber(toType) && fromType.IsEnum)
                return;

            var conversion = TypeSystemServices.FindExplicitConversionOperator(fromType, toType) ?? TypeSystemServices.FindImplicitConversionOperator(fromType, toType);
            if (null != conversion)
            {
                node.ParentNode.Replace(node, CodeBuilder.CreateMethodInvocation(conversion, node.Target));
                return;
            }

            if (toType.IsValueType)
            {
                if (TypeSystemServices.IsSystemObject(fromType))
                    return;
            }
            else if (!fromType.IsFinal)
                return;

            Error(CompilerErrorFactory.IncompatibleExpressionType(node, toType, fromType));
        }
ProcessMethodBodies