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); }
public void Void_With_Parameters_Method_Should_Return_The_Method_Name_And_Coma_Delimited_List_Of_Parameter_Types() { MethodInfo doSomething = ReflectOn <Subject> .ForMethod(x => x.DoSomething(null, null, null)); ClassMethodDescriptor descriptor = new ClassMethodDescriptor(doSomething); Assert.That(descriptor.Key, Is.EqualTo("DoSomething(String, Nullable<DateTime>, Subject)")); }
public void Ignore_Return_Type() { MethodInfo doSomething = ReflectOn <Subject> .ForMethod(x => x.DoSomething(null)); ClassMethodDescriptor descriptor = new ClassMethodDescriptor(doSomething); Assert.That(descriptor.Key, Is.EqualTo("DoSomething(String)")); }
public void Simple_Parameterless_Void_Method_Should_Return_The_Method_Name() { MethodInfo doSomething = ReflectOn <Subject> .ForMethod(x => x.DoSomething()); ClassMethodDescriptor descriptor = new ClassMethodDescriptor(doSomething); Assert.That(descriptor.Key, Is.EqualTo("DoSomething()")); }
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; }