@@ -795,16 +795,16 @@ Object slot(Object self) throws Throwable {
795795 Object meth = type .lookup (methodName );
796796 if (meth == null ) { throw SMUtil .EMPTY ; }
797797 // What kind of object did we find? (Could be anything.)
798- Representation rep = Representation .get (meth );
799- PyType methType = rep .pythonType (meth );
798+ Representation methRep = Representation .get (meth );
799+ PyType methType = methRep .pythonType (meth );
800800
801801 if (methType .isMethodDescr ()) {
802802 return Callables .call (meth , self );
803803 } else {
804804 // We might still have have to bind meth to self.
805805 if (methType .isDescr ()) {
806806 // Replace meth with result of descriptor binding.
807- meth = op_get . handle ( rep ).invokeExact (meth , self , type );
807+ meth = methRep . op_get ( ).invokeExact (meth , self , type );
808808 }
809809 // meth is now the thing to call.
810810 return Callables .call (meth );
@@ -833,16 +833,16 @@ Object slot(Object self, Object w) throws Throwable {
833833 Object meth = type .lookup (methodName );
834834 if (meth == null ) { throw SMUtil .EMPTY ; }
835835 // What kind of object did we find? (Could be anything.)
836- Representation rep = Representation .get (meth );
837- PyType methType = rep .pythonType (meth );
836+ Representation methRep = Representation .get (meth );
837+ PyType methType = methRep .pythonType (meth );
838838
839839 if (methType .isMethodDescr ()) {
840840 return Callables .call (meth , self , w );
841841 } else {
842842 // We might still have have to bind meth to self.
843843 if (methType .isDescr ()) {
844844 // Replace meth with result of descriptor binding.
845- meth = op_get . handle ( rep ).invokeExact (meth , self , type );
845+ meth = methRep . op_get ( ).invokeExact (meth , self , type );
846846 }
847847 // meth is now the thing to call.
848848 return Callables .call (meth , w );
@@ -872,16 +872,16 @@ Object slot(Object self, Object w, Object m) throws Throwable {
872872 Object meth = type .lookup (methodName );
873873 if (meth == null ) { throw SMUtil .EMPTY ; }
874874 // What kind of object did we find? (Could be anything.)
875- Representation rep = Representation .get (meth );
876- PyType methType = rep .pythonType (meth );
875+ Representation methRep = Representation .get (meth );
876+ PyType methType = methRep .pythonType (meth );
877877
878878 if (methType .isMethodDescr ()) {
879879 return Callables .call (meth , self , w , m );
880880 } else {
881881 // We might still have have to bind meth to self.
882882 if (methType .isDescr ()) {
883883 // Replace meth with result of descriptor binding.
884- meth = op_get . handle ( rep ).invokeExact (meth , self , type );
884+ meth = methRep . op_get ( ).invokeExact (meth , self , type );
885885 }
886886 // meth is now the thing to call.
887887 return Callables .call (meth , w , m );
@@ -913,16 +913,16 @@ Object slot(Object self, Object obj, PyType t) throws Throwable {
913913 Object meth = type .lookup (methodName );
914914 if (meth == null ) { throw SMUtil .EMPTY ; }
915915 // What kind of object did we find? (Could be anything.)
916- Representation rep = Representation .get (meth );
917- PyType methType = rep .pythonType (meth );
916+ Representation methRep = Representation .get (meth );
917+ PyType methType = methRep .pythonType (meth );
918918
919919 if (methType .isMethodDescr ()) {
920920 return Callables .call (meth , self , obj , t );
921921 } else {
922922 // We might still have have to bind meth to self.
923923 if (methType .isDescr ()) {
924924 // Replace meth with result of descriptor binding.
925- meth = op_get . handle ( rep ).invokeExact (meth , self , type );
925+ meth = methRep . op_get ( ).invokeExact (meth , self , type );
926926 }
927927 // meth is now the thing to call.
928928 return Callables .call (meth , obj , t );
@@ -947,6 +947,16 @@ public MethodHandle errorHandle() {
947947 return error ;
948948 }
949949
950+ /**
951+ * Whether this {@code SpecialMethod} has a corresponding cache in
952+ * {@link Representation} objects. If not, the effective
953+ * {@code MethodHandle} is always the {@link #generic} one.
954+ *
955+ * @param rep target {@code Representation}
956+ * @param mh handle value to assign
957+ */
958+ public boolean hasCache () { return cache != null ; }
959+
950960 /**
951961 * Set the cache for this {@code SpecialMethod} in the
952962 * {@link Representation} to the given {@code MethodHandle}.
0 commit comments