private PythonClassType CreateClass(ClassDefinition cd)
        {
            var cls = new PythonClassType(cd, _eval.GetLocationOfName(cd),
                                          _eval.SuppressBuiltinLookup ? BuiltinTypeId.Unknown : BuiltinTypeId.Type);

            _typeMap[cd] = cls;
            return(cls);
        }
        private PythonClassType CreateClass(ClassDefinition cd)
        {
            PythonType declaringType = null;

            if (!(cd.Parent is PythonAst))
            {
                Debug.Assert(_typeMap.ContainsKey(cd.Parent));
                _typeMap.TryGetValue(cd.Parent, out declaringType);
            }
            var cls = new PythonClassType(cd, declaringType, _eval.GetLocationOfName(cd),
                                          _eval.SuppressBuiltinLookup ? BuiltinTypeId.Unknown : BuiltinTypeId.Type);

            _typeMap[cd] = cls;

            declaringType?.AddMember(cls.Name, cls, overwrite: true);
            return(cls);
        }
        private PythonClassType CreateClass(ClassDefinition cd)
        {
            PythonType declaringType = null;

            if (!(cd.Parent is PythonAst))
            {
                if (!_typeMap.TryGetValue(cd.Parent, out declaringType))
                {
                    // we can get into this situation if parent is defined twice and we preserve
                    // only one of them.
                    // for example, code has function definition with exact same signature
                    // and class is defined under one of that function
                    return(null);
                }
            }
            var cls = new PythonClassType(cd, declaringType, _eval.GetLocationOfName(cd),
                                          _eval.SuppressBuiltinLookup ? BuiltinTypeId.Unknown : BuiltinTypeId.Type);

            _typeMap[cd] = cls;

            declaringType?.AddMember(cls.Name, cls, overwrite: true);
            return(cls);
        }