Exemplo n.º 1
0
 public override MSAst TransformCore(ScriptGenerator generator)
 {
     return(generator.ConvertTo(
                _destinationType.Type,
                ConversionResultKind.ExplicitCast,
                _child.Transform(generator)));
 }
Exemplo n.º 2
0
        public override MSAst TransformCore(ScriptGenerator generator)
        {
            var transformedOperator = _operand.Transform(generator);

            if (transformedOperator.Type == _targetType.Type)
            {
                return(transformedOperator);
            }

            if (Type == TypeManager.CoreTypes.String)
            {
                return(MSAst.Call(
                           transformedOperator,
                           CommonMembers.ObjectToString));
            }

            return(generator.ConvertTo(
                       Type,
                       IsImplicitConversionRequired
                    ? ConversionResultKind.ImplicitCast
                    : ConversionResultKind.ExplicitCast,
                       transformedOperator));
        }