|
53 | 53 | import com.oracle.graal.python.builtins.CoreFunctions;
|
54 | 54 | import com.oracle.graal.python.builtins.PythonBuiltinClassType;
|
55 | 55 | import com.oracle.graal.python.builtins.PythonBuiltins;
|
56 |
| -import com.oracle.graal.python.builtins.modules.BuiltinConstructors; |
| 56 | +import com.oracle.graal.python.builtins.modules.BuiltinConstructorsFactory; |
57 | 57 | import com.oracle.graal.python.builtins.objects.PNone;
|
58 | 58 | import com.oracle.graal.python.builtins.objects.PNotImplemented;
|
59 | 59 | import com.oracle.graal.python.builtins.objects.PythonAbstractObject;
|
@@ -213,22 +213,23 @@ public PNone init(Object self, Object[] arguments, PKeyword[] keywords,
|
213 | 213 | @Cached("createIdentityProfile()") ValueProfile profileNew) {
|
214 | 214 | if (arguments.length != 0 || keywords.length != 0) {
|
215 | 215 | Object type = lib.getLazyPythonClass(self);
|
216 |
| - if (overridesBuiltinMethod(type, profileInit, lookupInit, InitNode.class)) { |
| 216 | + if (overridesBuiltinMethod(type, profileInit, lookupInit, ObjectBuiltinsFactory.InitNodeFactory.class)) { |
217 | 217 | throw raise(TypeError, ErrorMessages.INIT_TAKES_ONE_ARG_OBJECT);
|
218 | 218 | }
|
219 | 219 |
|
220 |
| - if (!overridesBuiltinMethod(type, profileInit, lookupNew, BuiltinConstructors.ObjectNode.class)) { |
| 220 | + if (!overridesBuiltinMethod(type, profileInit, lookupNew, BuiltinConstructorsFactory.ObjectNodeFactory.class)) { |
221 | 221 | throw raise(TypeError, ErrorMessages.INIT_TAKES_ONE_ARG, type);
|
222 | 222 | }
|
223 | 223 | }
|
224 | 224 | return PNone.NONE;
|
225 | 225 | }
|
226 | 226 |
|
227 |
| - public static <T> boolean overridesBuiltinMethod(Object type, ValueProfile profile, LookupAttributeInMRONode lookup, Class<T> builtinNodeClass) { |
| 227 | + public static <T extends NodeFactory<? extends PythonBuiltinBaseNode>> boolean overridesBuiltinMethod(Object type, ValueProfile profile, LookupAttributeInMRONode lookup, |
| 228 | + Class<T> builtinNodeFactoryClass) { |
228 | 229 | Object method = profile.profile(lookup.execute(type));
|
229 | 230 | if (method instanceof PBuiltinFunction) {
|
230 | 231 | NodeFactory<? extends PythonBuiltinBaseNode> factory = ((PBuiltinFunction) method).getBuiltinNodeFactory();
|
231 |
| - return factory == null || !builtinNodeClass.isAssignableFrom(factory.getNodeClass()); |
| 232 | + return !builtinNodeFactoryClass.isInstance(factory); |
232 | 233 | }
|
233 | 234 | return true;
|
234 | 235 | }
|
|
0 commit comments