Пример #1
0
        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)
        {
            Expression[] elems = new Expression[_count];
            for (int i = 0; i < _count; i++)
            {
                elems[i] = context.ConvertExpression(parameters[_start + i], _elementType);
            }

            return(Ast.NewArray(_elementType.MakeArrayType(), elems));
        }
Пример #3
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));
        }
Пример #4
0
 internal override Expression ToExpression(MethodBinderContext context, Expression[] parameters)
 {
     Debug.Assert(_index < parameters.Length);
     Debug.Assert(parameters[_index] != null);
     return context.ConvertExpression(parameters[_index], _parameterType);
 }
Пример #5
0
 internal override Expression ToExpression(MethodBinderContext context, Expression[] parameters)
 {
     Debug.Assert(_index < parameters.Length);
     Debug.Assert(parameters[_index] != null);
     return(context.ConvertExpression(parameters[_index], _parameterType));
 }
Пример #6
0
        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);            
        }
Пример #7
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);
        }