예제 #1
0
        public static KnownTypes CreateDefault(PythonAnalyzer state, PythonTypeDatabase fallbackDb) {
            var res = new KnownTypes();

            var fallback = fallbackDb.BuiltinModule;

            for (int value = 0; value < res._types.Length; ++value) {
                res._types[value] = (IPythonType)fallback.GetAnyMember(
                    ((ITypeDatabaseReader)fallbackDb).GetBuiltinTypeName((BuiltinTypeId)value)
                );
            }

            res.SetClassInfo(state);
            return res;
        }
예제 #2
0
파일: KnownTypes.cs 프로젝트: wenh123/PTVS
        public static KnownTypes Create(PythonAnalyzer state, PythonTypeDatabase fallbackDb) {
            var res = new KnownTypes();

            var interpreter = state.Interpreter;
            var fallback = fallbackDb.BuiltinModule;

            for (int value = 0; value < res._types.Length; ++value) {
                try {
                    res._types[value] = interpreter.GetBuiltinType((BuiltinTypeId)value);
                } catch (KeyNotFoundException) {
                    res._types[value] = (IPythonType)fallback.GetAnyMember(
                        ((ITypeDatabaseReader)fallbackDb).GetBuiltinTypeName((BuiltinTypeId)value)
                    );
                }
            }

            res.SetClassInfo(state);
            return res;
        }
예제 #3
0
        public static KnownTypes Create(PythonAnalyzer state, PythonTypeDatabase fallbackDb)
        {
            var res = new KnownTypes();

            var interpreter = state.Interpreter;
            var fallback    = fallbackDb.BuiltinModule;

            for (int value = 0; value < res._types.Length; ++value)
            {
                try {
                    res._types[value] = interpreter.GetBuiltinType((BuiltinTypeId)value);
                } catch (KeyNotFoundException) {
                    res._types[value] = (IPythonType)fallback.GetAnyMember(
                        ((ITypeDatabaseReader)fallbackDb).GetBuiltinTypeName((BuiltinTypeId)value)
                        );
                }
            }

            res.SetClassInfo(state);
            return(res);
        }