Пример #1
0
        private static Dictionary<Type, ExtensionTypeInfo> MakeSystemTypes()
        {
            Dictionary<Type, ExtensionTypeInfo> res = new Dictionary<Type, ExtensionTypeInfo>();

            // Native CLR types
            res[typeof(int)] = new ExtensionTypeInfo(typeof(Int32Ops), "Int");
            res[typeof(string)] = new ExtensionTypeInfo(typeof(StringOps), "String");

            return res;
        }
Пример #2
0
        /// <summary>
        /// Creates a table of standard .NET types which are also standard Python types.  These types have a standard
        /// set of extension types which are shared between all runtimes.
        /// </summary>
        private static Dictionary<Type/*!*/, ExtensionTypeInfo/*!*/>/*!*/ MakeSystemTypes() {
            Dictionary<Type/*!*/, ExtensionTypeInfo/*!*/> res = new Dictionary<Type, ExtensionTypeInfo>();

            // Native CLR types
            res[typeof(object)] = new ExtensionTypeInfo(typeof(ObjectOps), "object");
            res[typeof(string)] = new ExtensionTypeInfo(typeof(StringOps), "str");
            res[typeof(int)] = new ExtensionTypeInfo(typeof(Int32Ops), "int");
            res[typeof(bool)] = new ExtensionTypeInfo(typeof(BoolOps), "bool");
            res[typeof(double)] = new ExtensionTypeInfo(typeof(DoubleOps), "float");
            res[typeof(ValueType)] = new ExtensionTypeInfo(typeof(ValueType), "ValueType");   // just hiding it's methods in the inheritance hierarchy

            // MS.Math types
            res[typeof(BigInteger)] = new ExtensionTypeInfo(typeof(BigIntegerOps), "long");
            res[typeof(Complex64)] = new ExtensionTypeInfo(typeof(ComplexOps), "complex");

            // DLR types
            res[typeof(DynamicNull)] = new ExtensionTypeInfo(typeof(NoneTypeOps), "NoneType");
            res[typeof(BaseSymbolDictionary)] = new ExtensionTypeInfo(typeof(DictionaryOps), "dict");
            res[typeof(IAttributesCollection)] = new ExtensionTypeInfo(typeof(DictionaryOps), "dict");
            res[typeof(NamespaceTracker)] = new ExtensionTypeInfo(typeof(ReflectedPackageOps), "namespace#");
            res[typeof(TypeGroup)] = new ExtensionTypeInfo(typeof(TypeGroupOps), "type-collision");
            res[typeof(TypeTracker)] = new ExtensionTypeInfo(typeof(TypeTrackerOps), "type-collision");
            res[typeof(Scope)] = new ExtensionTypeInfo(typeof(ScopeOps), "module");
            res[typeof(ScriptScope)] = new ExtensionTypeInfo(typeof(ScriptScopeOps), "module");
#if !SILVERLIGHT
            res[Type.GetType("System.__ComObject")] = new ExtensionTypeInfo(typeof(ComOps), "__ComObject");
#endif

            return res;
        }