示例#1
0
 internal CPythonFunction(string name, string doc, bool isBuiltin, bool isStatic, IMemberContainer declaringType)
 {
     _name            = name;
     _doc             = doc;
     _isBuiltin       = isBuiltin;
     _isStatic        = isStatic;
     _declaringModule = CPythonModule.GetDeclaringModuleFromContainer(declaringType);
     _declaringType   = declaringType as IPythonType;
     _overloads       = new List <IPythonFunctionOverload>();
 }
示例#2
0
        public CPythonFunction(ITypeDatabaseReader typeDb, string name, Dictionary <string, object> functionTable, IMemberContainer declaringType, bool isMethod = false)
        {
            _name = name;

            object doc;

            if (functionTable.TryGetValue("doc", out doc))
            {
                _doc = doc as string;
            }

            object value;

            if (functionTable.TryGetValue("builtin", out value))
            {
                _isBuiltin = Convert.ToBoolean(value);
            }
            else
            {
                _isBuiltin = true;
            }

            if (functionTable.TryGetValue("static", out value))
            {
                _isStatic = Convert.ToBoolean(value);
            }
            else
            {
                _isStatic = false;
            }

            if (functionTable.TryGetValue("classmethod", out value))
            {
                _isClassMethod = Convert.ToBoolean(value);
            }
            else
            {
                _isClassMethod = false;
            }

            _hasLocation = PythonTypeDatabase.TryGetLocation(functionTable, ref _line, ref _column);

            _declaringModule = CPythonModule.GetDeclaringModuleFromContainer(declaringType);
            _declaringType   = declaringType as IPythonType;

            if (functionTable.TryGetValue("overloads", out value))
            {
                _overloads = LoadOverloads(typeDb, value, isMethod);
            }
        }
        public CPythonProperty(ITypeDatabaseReader typeDb, Dictionary <string, object> valueDict, IMemberContainer container)
        {
            _declaringModule = CPythonModule.GetDeclaringModuleFromContainer(container);

            object value;

            if (valueDict.TryGetValue("doc", out value))
            {
                _doc = value as string;
            }

            object type;

            valueDict.TryGetValue("type", out type);

            _hasLocation = PythonTypeDatabase.TryGetLocation(valueDict, ref _line, ref _column);

            typeDb.LookupType(type, typeValue => _type = typeValue);
        }