Skip to content

Commit 5855a1b

Browse files
committed
Fix nits
1 parent d7f52d2 commit 5855a1b

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/runtime/classmanager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ private static ClassInfo GetClassInfo(Type type)
470470

471471
ob = new MethodObject(type, name, mlist);
472472
ci.members[name] = ob;
473-
if (OperatorMethod.IsOperatorMethod(mlist[0]))
473+
if (mlist.Any(OperatorMethod.IsOperatorMethod))
474474
{
475475
ci.members[OperatorMethod.GetPyMethodName(name)] = ob;
476476
}

src/runtime/methodbinder.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ internal Binding Bind(IntPtr inst, IntPtr args, IntPtr kw, MethodBase info, Meth
342342
bool paramsArray;
343343
int kwargsMatched;
344344
int defaultsNeeded;
345-
bool isOperator = OperatorMethod.IsOperatorMethod(mi); // e.g. op_Addition is defined for OperableObject
345+
bool isOperator = OperatorMethod.IsOperatorMethod(mi);
346346
if (!MatchesArgumentCount(pynargs, pi, kwargDict, isOperator, out paramsArray, out defaultArgList, out kwargsMatched, out defaultsNeeded))
347347
{
348348
continue;
@@ -362,12 +362,11 @@ internal Binding Bind(IntPtr inst, IntPtr args, IntPtr kw, MethodBase info, Meth
362362
{
363363
if (inst != IntPtr.Zero)
364364
{
365-
var co = ManagedType.GetManagedObject(inst) as CLRObject;
366-
if (co == null)
365+
if (ManagedType.GetManagedObject(inst) is CLRObject co)
367366
{
368-
break;
367+
margs[0] = co.inst;
369368
}
370-
margs[0] = co.inst;
369+
else { break; }
371370
}
372371
}
373372

0 commit comments

Comments
 (0)