internal void MapParameters(bool reduceByRef) {
            if (reduceByRef) {
                _returnArgs = new List<int>();
                if (CompilerHelpers.GetReturnType(_method) != typeof(void)) {
                    _returnArgs.Add(-1);
                }
            }

            BitArray specialParameters = _resolver.MapSpecialParameters(this);

            if (_instanceBuilder == null) {
                _instanceBuilder = new InstanceBuilder(-1);
            }

            for (int infoIndex = 0; infoIndex < _parameterInfos.Length; infoIndex++) {
                if (!IsSpecialParameter(specialParameters, infoIndex)) {
                    if (reduceByRef) {
                        MapParameterReduceByRef(_parameterInfos[infoIndex]);
                    } else {
                        MapParameter(_parameterInfos[infoIndex]);
                    }
                }
            }

            _returnBuilder = MakeReturnBuilder(specialParameters);
        }
Exemple #2
0
        internal void MapParameters(bool reduceByRef) {
            if (reduceByRef) {
                _returnArgs = new List<int>();
                if (_overload.ReturnType != typeof(void)) {
                    _returnArgs.Add(-1);
                }
            }

            BitArray specialParameters = _resolver.MapSpecialParameters(this);

            if (_instanceBuilder == null) {
                _instanceBuilder = new InstanceBuilder(-1);
            }

            foreach (var parameter in _overload.Parameters) {
                if (!IsSpecialParameter(specialParameters, parameter.Position)) {
                    if (reduceByRef) {
                        MapParameterReduceByRef(parameter);
                    } else {
                        MapParameter(parameter);
                    }
                }
            }

            _returnBuilder = MakeReturnBuilder(specialParameters);
        }
        internal MethodCandidate(OverloadResolver resolver, MethodBase method, List<ParameterWrapper> parameters, ParameterWrapper paramsDict,
            ReturnBuilder returnBuilder, InstanceBuilder instanceBuilder, IList<ArgBuilder> argBuilders) {

            Assert.NotNull(resolver, method, instanceBuilder, returnBuilder);
            Assert.NotNullItems(parameters);
            Assert.NotNullItems(argBuilders);

            _resolver = resolver;
            _method = method;
            _instanceBuilder = instanceBuilder;
            _argBuilders = argBuilders;
            _returnBuilder = returnBuilder;
            _parameters = parameters;
            _paramsDict = paramsDict;

            _paramsArrayIndex = ParameterWrapper.IndexOfParamsArray(parameters);

            parameters.TrimExcess();
        }
Exemple #4
0
        internal MethodCandidate(OverloadResolver resolver, OverloadInfo method, List <ParameterWrapper> parameters, ParameterWrapper paramsDict,
                                 ReturnBuilder returnBuilder, InstanceBuilder instanceBuilder, IList <ArgBuilder> argBuilders, Dictionary <DynamicMetaObject, BindingRestrictions> restrictions)
        {
            Assert.NotNull(resolver, method, instanceBuilder, returnBuilder);
            Assert.NotNullItems(parameters);
            Assert.NotNullItems(argBuilders);

            Resolver         = resolver;
            Overload         = method;
            _instanceBuilder = instanceBuilder;
            ArgBuilders      = argBuilders;
            ReturnBuilder    = returnBuilder;
            _parameters      = parameters;
            _paramsDict      = paramsDict;
            Restrictions     = restrictions;

            ParamsArrayIndex = ParameterWrapper.IndexOfParamsArray(parameters);

            parameters.TrimExcess();
        }
        internal MethodCandidate(OverloadResolver resolver, OverloadInfo method, List<ParameterWrapper> parameters, ParameterWrapper paramsDict,
            ReturnBuilder returnBuilder, InstanceBuilder instanceBuilder, IList<ArgBuilder> argBuilders, Dictionary<DynamicMetaObject, BindingRestrictions> restrictions) {

            Assert.NotNull(resolver, method, instanceBuilder, returnBuilder);
            Assert.NotNullItems(parameters);
            Assert.NotNullItems(argBuilders);

            _resolver = resolver;
            _overload = method;
            _instanceBuilder = instanceBuilder;
            _argBuilders = argBuilders;
            _returnBuilder = returnBuilder;
            _parameters = parameters;
            _paramsDict = paramsDict;
            _restrictions = restrictions;

            _paramsArrayIndex = ParameterWrapper.IndexOfParamsArray(parameters);

            parameters.TrimExcess();
        }
 public void AddInstanceBuilder(InstanceBuilder builder) {
     ContractUtils.Requires(_instanceBuilder == null);
     ContractUtils.Requires(builder.HasValue);
     _instanceBuilder = builder;
     _argIndex += builder.ConsumedArgumentCount;
 }