public bool __eq__(object other) { BuiltinMethodDescriptor bmd = other as BuiltinMethodDescriptor; if (bmd == null) { return false; } if (PythonOps.Id(__objclass__) != PythonOps.Id(bmd.__objclass__)) { return false; } return __name__ == bmd.__name__; }
public BuiltinMethodInfo(BuiltinMethodDescriptor method, ProjectState projectState) : base(ClrModule.GetPythonType(typeof(BuiltinMethodDescriptor)), projectState) { // TODO: get return information, parameters, members _method = method; var function = PythonOps.GetBuiltinMethodDescriptorTemplate(method); _returnTypes = Utils.GetReturnTypes(function, projectState); _doc = null; }
public int __cmp__(object other) { BuiltinMethodDescriptor bmd = other as BuiltinMethodDescriptor; if (bmd == null) { throw PythonOps.TypeError("instancemethod.__cmp__(x,y) requires y to be a 'instancemethod', not a {0}", PythonTypeOps.GetName(other)); } long result = PythonOps.Id(__objclass__) - PythonOps.Id(bmd.__objclass__); if (result != 0) { return (result > 0) ? 1 : -1; } return StringOps.Compare(__name__, bmd.__name__); }
internal static PythonTypeSlot/*!*/ GetFinalSlotForFunction(BuiltinFunction/*!*/ func) { if ((func.FunctionType & FunctionType.Method) != 0) { BuiltinMethodDescriptor desc; lock (_methodCache) { if (!_methodCache.TryGetValue(func, out desc)) { _methodCache[func] = desc = new BuiltinMethodDescriptor(func); } return desc; } } if (func.Targets[0].IsDefined(typeof(ClassMethodAttribute), true)) { lock (_classMethodCache) { ClassMethodDescriptor desc; if (!_classMethodCache.TryGetValue(func, out desc)) { _classMethodCache[func] = desc = new ClassMethodDescriptor(func); } return desc; } } return func; }
internal DictionaryGetMethod(BuiltinMethodDescriptor method, ProjectState projectState, DictionaryInfo myDict) : base(method, projectState) { _myDict = myDict; }
public MetaBuiltinMethodDescriptor(Expression/*!*/ expression, BindingRestrictions/*!*/ restrictions, BuiltinMethodDescriptor/*!*/ value) : base(expression, BindingRestrictions.Empty, value) { Assert.NotNull(value); }