Exemple #1
0
        internal CPythonConstant GetConstant(CPythonType type)
        {
            CPythonConstant constant;

            if (!_constants.TryGetValue(type, out constant))
            {
                _constants[type] = constant = new CPythonConstant(type);
            }
            return(constant);
        }
Exemple #2
0
        private void StoreMember(string memberName, IMember value)
        {
            CPythonType type = value as CPythonType;

            if (type != null && !type.IncludeInModule)
            {
                if (_hiddenMembers == null)
                {
                    _hiddenMembers = new Dictionary <string, IMember>();
                }
                _hiddenMembers[memberName] = type;
            }
            else
            {
                _members[memberName] = value;
            }
        }
Exemple #3
0
        public CPythonFunction(TypeDatabase 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 = true;
            }

            _declaringModule = (declaringType as CPythonModule) ?? (CPythonModule)((CPythonType)declaringType).DeclaringModule;
            object overloads;

            functionTable.TryGetValue("overloads", out overloads);
            _overloads     = LoadOverloads(typeDb, overloads, isMethod);
            _declaringType = declaringType as CPythonType;
        }
Exemple #4
0
 public CPythonConstant(CPythonType type)
 {
     _type = type;
 }