コード例 #1
0
        public static PythonType GetItem(TypeGroup self, params object[] types)
        {
            PythonType[] pythonTypes = new PythonType[types.Length];
            for (int i = 0; i < types.Length; i++)
            {
                object t = types[i];
                if (t is PythonType)
                {
                    pythonTypes[i] = (PythonType)t;
                    continue;
                }
                else if (t is TypeGroup)
                {
                    TypeGroup typeGroup = t as TypeGroup;
                    Type      nonGenericType;
                    if (!typeGroup.TryGetNonGenericType(out nonGenericType))
                    {
                        throw PythonOps.TypeError("cannot use open generic type {0} as type argument", typeGroup.Name);
                    }
                    pythonTypes[i] = DynamicHelpers.GetPythonTypeFromType(nonGenericType);
                }
                else
                {
                    throw PythonOps.TypeErrorForTypeMismatch("type", t);
                }
            }

            return(GetItemHelper(self, pythonTypes));
        }