public CPythonMethodDescriptor(ITypeDatabaseReader typeDb, string name, Dictionary<string, object> valueDict, IMemberContainer declaringType) { _name = name; _func = new CPythonFunction(typeDb, name, valueDict, declaringType, isMethod: true); object value; if (valueDict.TryGetValue("bound", out value)) { _isBound = (value as bool?) ?? false; } }
public CPythonMethodDescriptor(ITypeDatabaseReader typeDb, string name, Dictionary <string, object> valueDict, IMemberContainer declaringType) { _name = name; _func = new CPythonFunction(typeDb, name, valueDict, declaringType, isMethod: true); object value; if (valueDict.TryGetValue("bound", out value)) { _isBound = (value as bool?) ?? false; } }
public CPythonFunctionOverload( ITypeDatabaseReader typeDb, CPythonFunction function, Dictionary <string, object> argInfo, bool isMethod ) { _parameters = EmptyParameters; if (argInfo != null) { object args; object[] argList; if (argInfo.TryGetValue("args", out args) && (argList = args as object[]) != null) { if ((isMethod && argList.Length > 1) || (!isMethod && argList.Length > 0)) { _parameters = argList.Skip(isMethod ? 1 : 0) .OfType <Dictionary <string, object> >() .Select(arg => new CPythonParameterInfo(typeDb, arg)) .ToArray(); } } object docObj; if (argInfo.TryGetValue("doc", out docObj)) { _doc = docObj as string; } if (string.IsNullOrEmpty(_doc)) { _doc = function.Documentation; } if (argInfo.TryGetValue("return_doc", out docObj)) { _returnDoc = docObj as string; } object retType; if (argInfo.TryGetValue("ret_type", out retType)) { _retType = new List <IPythonType>(); typeDb.LookupType(retType, value => _retType.Add(value)); } } }
public CPythonFunctionOverload( ITypeDatabaseReader typeDb, CPythonFunction function, Dictionary<string, object> argInfo, bool isMethod ) { _parameters = EmptyParameters; if (argInfo != null) { object args; object[] argList; if (argInfo.TryGetValue("args", out args) && (argList = args as object[]) != null) { if ((isMethod && argList.Length > 1) || (!isMethod && argList.Length > 0)) { _parameters = argList.Skip(isMethod ? 1 : 0) .OfType<Dictionary<string, object>>() .Select(arg => new CPythonParameterInfo(typeDb, arg)) .ToArray(); } } object docObj; if (argInfo.TryGetValue("doc", out docObj)) { _doc = docObj as string; } if (string.IsNullOrEmpty(_doc)) { _doc = function.Documentation; } if (argInfo.TryGetValue("return_doc", out docObj)) { _returnDoc = docObj as string; } object retType; if (argInfo.TryGetValue("ret_type", out retType)) { _retType = new List<IPythonType>(); typeDb.LookupType(retType, value => _retType.Add(value)); } } }