internal override Expression ToExpression(MethodBinderContext context, Expression[] parameters)
        {
            object val = _defaultValue;

            if (val is Missing)
            {
                val = CompilerHelpers.GetMissingValue(_argumentType);
            }


#if FULL
            if (_argumentType.IsByRef)
            {
                Variable tmp = context.GetTemporary(_argumentType.GetElementType(), "optRef");
                return(Ast.Comma(
                           Ast.Assign(
                               tmp,
                               Ast.Convert(Ast.Constant(val), tmp.Type)
                               ),
                           Ast.Read(tmp)
                           ));
            }
#endif


            return(context.ConvertExpression(Ast.Constant(val), _argumentType));
        }
示例#2
0
        internal override Expression ToExpression(MethodBinderContext context, Expression[] parameters)
        {
            object val = _defaultValue;

            if (val is Missing)
            {
                val = CompilerHelpers.GetMissingValue(_argumentType);
            }

            return(context.ConvertExpression(Ast.Constant(val), _argumentType));
        }