MakeByRefType() public method

public MakeByRefType ( ) : Type
return Type
Ejemplo n.º 1
0
        public ParameterGen <T> BeginParameter(Type type, string name)
        {
            ParameterAttributes attrs = 0;
            bool va = false;

            switch (_paramMod)
            {
            case ParamModifier.Out:
                attrs |= ParameterAttributes.Out;
                goto case ParamModifier.Ref;

            case ParamModifier.Ref:
                if (!type.IsByRef)
                {
                    type = type.MakeByRefType();
                }
                break;

            case ParamModifier.Params:
                if (!type.IsArray)
                {
                    throw new InvalidOperationException(Messages.ErrParamArrayNotArray);
                }
                va = true;
                break;
            }

            ParameterGen <T> pgen = new ParameterGen <T>(TypedThis, _parameters, _parameters.Count + 1, type, attrs, name, va);

            _parameters.Add(pgen);
            _paramMod = ParamModifier.None;
            return(pgen);
        }
Ejemplo n.º 2
0
        public ContextualOperand This()
        {
            if (Context.IsStatic)
            {
                throw new InvalidOperationException(Properties.Messages.ErrCodeStaticThis);
            }

            Type ownerType = Context.OwnerType;

            if (Context.OwnerType.IsValueType)
            {
                var m = Context.Member as MethodInfo;
                if (m != null && m.IsVirtual)
                {
                    ownerType = ownerType.MakeByRefType();
                }
            }

            Operand arg = new _Arg(0, ownerType);

            return(new ContextualOperand(arg, TypeMapper));
        }