Exemplo n.º 1
0
        public static MethodWrapper Make(PythonType pt, SymbolId name)
        {
            MethodWrapper ret = new MethodWrapper(pt, name);
            object        meth;

            if (pt.dict.TryGetValue(name, out meth))
            {
                object otherMeth;
                if (!pt.TryLookupSlotInBases(DefaultContext.Default, name, out otherMeth) || otherMeth != meth)
                {
                    ret.SetDeclaredMethod(meth);
                }
                else
                {
                    // they did __foo__ = myBase.__foo__, we'll just ignore it...
                    ret.UpdateFromBases(pt.MethodResolutionOrder);
                }
            }
            else
            {
                ret.UpdateFromBases(pt.MethodResolutionOrder);
            }

            //pt.dict[name] = ret; //???

            return(ret);
        }
Exemplo n.º 2
0
        public bool TryGetAttr(ICallerContext context, SymbolId name, out object value)
        {
            if (__thisclass__.TryLookupSlotInBases(context, name, out value))
            {
                value = Ops.GetDescriptor(value, __self__, __self_class__);
                return(true);
            }


            return(SuperType.TryGetAttr(context, this, name, out value));
        }