private ParameterWrapper CreateParameterWrapper(ParameterInfo info) { bool isParamArray = _overload.IsParamArray(info.Position); bool isParamDict = !isParamArray && _overload.IsParamDictionary(info.Position); bool prohibitsNullItems = (isParamArray || isParamDict) && _overload.ProhibitsNullItems(info.Position); return(new ParameterWrapper( info, info.ParameterType, info.Name, (_overload.ProhibitsNull(info.Position) ? ParameterBindingFlags.ProhibitNull : 0) | (prohibitsNullItems ? ParameterBindingFlags.ProhibitNullItems : 0) | (isParamArray ? ParameterBindingFlags.IsParamArray : 0) | (isParamDict ? ParameterBindingFlags.IsParamDictionary : 0) )); }
internal static void GetParameterCount(OverloadInfo/*!*/ method, SelfCallConvention callConvention, out int mandatory, out int optional) { mandatory = 0; optional = 0; for (int i = GetHiddenParameterCount(method, callConvention); i < method.ParameterCount; i++) { var info = method.Parameters[i]; if (method.IsParamArray(i)) { // TODO: indicate splat args separately? optional++; } else if (info.IsOutParameter()) { // Python allows passing of optional "clr.Reference" to capture out parameters // Ruby should allow similar optional++; } else if (info.IsMandatory()) { mandatory++; } else { optional++; } } }