@Override protected RubyClass getSuperClass(RubyClass definingModule) { return definingModule.getSuperClass(); }
@Override protected RubyClass getSuperClass(RubyClass definingModule) { return definingModule.getSuperClass(); }
public static Class<? extends IRubyObject> nearestReifiedClass(final RubyClass klass) { RubyClass current = klass; do { Class<? extends IRubyObject> reified = current.getReifiedClass(); if ( reified != null ) return reified; current = current.getSuperClass(); } while ( current != null ); return null; }
public static Class<? extends IRubyObject> nearestReifiedClass(final RubyClass klass) { RubyClass current = klass; do { Class<? extends IRubyObject> reified = current.getReifiedClass(); if ( reified != null ) return reified; current = current.getSuperClass(); } while ( current != null ); return null; }
private RubyClass classOf() { final RubyClass metaClass = getMetaClass(); return metaClass instanceof MetaClass ? metaClass.getSuperClass() : metaClass; }
private RubyClass classOf() { final RubyClass metaClass = getMetaClass(); return metaClass instanceof MetaClass ? metaClass.getSuperClass() : metaClass; }
@Override protected RubyClass getSuperClass(RubyClass definingModule) { return definingModule.getMetaClass().getMetaClass().getSuperClass(); }
private static IRubyObject getInternalVariable(RubyClass type, String internedName) { RubyClass structClass = type.getRuntime().getStructClass(); IRubyObject variable; while (type != null && type != structClass) { if ((variable = (IRubyObject)type.getInternalVariable(internedName)) != null) { return variable; } type = type.getSuperClass(); } return type.getRuntime().getNil(); }
private static IRubyObject getInternalVariable(RubyClass type, String internedName) { RubyClass structClass = type.getRuntime().getStructClass(); IRubyObject variable; while (type != null && type != structClass) { if ((variable = (IRubyObject)type.getInternalVariable(internedName)) != null) { return variable; } type = type.getSuperClass(); } return type.getRuntime().getNil(); }
private static IRubyObject getInternalVariable(RubyClass type, String internedName) { RubyClass structClass = type.getRuntime().getStructClass(); IRubyObject variable; while (type != null && type != structClass) { if ((variable = (IRubyObject)type.getInternalVariable(internedName)) != null) { return variable; } type = type.getSuperClass(); } return type.getRuntime().getNil(); }
private static IRubyObject getInternalVariable(RubyClass type, String internedName) { RubyClass structClass = type.getRuntime().getStructClass(); IRubyObject variable; while (type != null && type != structClass) { if ((variable = (IRubyObject)type.getInternalVariable(internedName)) != null) { return variable; } type = type.getSuperClass(); } return type.getRuntime().getNil(); }
public static IRubyObject allocateProxy(Object javaObject, RubyClass clazz) { // Arrays are never stored in OPC if (clazz.getSuperClass() == clazz.getRuntime().getJavaSupport().getArrayProxyClass()) { return new ArrayJavaProxy(clazz.getRuntime(), clazz, javaObject, JavaUtil.getJavaConverter(javaObject.getClass().getComponentType())); } IRubyObject proxy = clazz.allocate(); if (proxy instanceof JavaProxy) { ((JavaProxy)proxy).setObject(javaObject); } else { JavaObject wrappedObject = JavaObject.wrap(clazz.getRuntime(), javaObject); proxy.dataWrapStruct(wrappedObject); } return proxy; }
private static void reifyWithAncestors(RubyClass klazz) { RubyClass realSuper = klazz.getSuperClass().getRealClass(); if (realSuper.getReifiedClass() == null) reifyWithAncestors(realSuper); synchronized (klazz) { klazz.reify(); klazz.setAllocator(new ReifyingAllocator(klazz.getReifiedClass())); } } }
private static void reifyWithAncestors(RubyClass klazz) { RubyClass realSuper = klazz.getSuperClass().getRealClass(); if (realSuper.getReifiedClass() == null) reifyWithAncestors(realSuper); synchronized (klazz) { klazz.reify(); klazz.setAllocator(new ReifyingAllocator(klazz.getReifiedClass())); } } }
private static void reifyWithAncestors(RubyClass klazz) { RubyClass realSuper = klazz.getSuperClass().getRealClass(); if (realSuper.getReifiedClass() == null) reifyWithAncestors(realSuper); synchronized (klazz) { klazz.reify(); klazz.setAllocator(new ReifyingAllocator(klazz.getReifiedClass())); } } }
private static void reifyWithAncestors(RubyClass klazz) { RubyClass realSuper = klazz.getSuperClass().getRealClass(); if (realSuper.getReifiedClass() == null) reifyWithAncestors(realSuper); synchronized (klazz) { klazz.reify(); klazz.setAllocator(new ReifyingAllocator(klazz.getReifiedClass())); } } }
private RubyClass getSuperSingletonMetaClass() { if (attached instanceof RubyClass) { RubyClass superClass = ((RubyClass) attached).getSuperClass(); if (superClass != null) superClass = superClass.getRealClass(); // #<Class:BasicObject>'s singleton class == Class.singleton_class if (superClass == null) return runtime.getClassClass().getSingletonClass(); return superClass.getMetaClass().getSingletonClass(); } return getSuperClass().getRealClass().getMetaClass(); // NOTE: is this correct? }
private RubyClass getSuperSingletonMetaClass() { if (attached instanceof RubyClass) { RubyClass superClass = ((RubyClass) attached).getSuperClass(); if (superClass != null) superClass = superClass.getRealClass(); // #<Class:BasicObject>'s singleton class == Class.singleton_class if (superClass == null) return runtime.getClassClass().getSingletonClass(); return superClass.getMetaClass().getSingletonClass(); } return getSuperClass().getRealClass().getMetaClass(); // NOTE: is this correct? }
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block aBlock) { IRubyObject[] args = prepareArguments(context, self, getCallArgs(), currDynScope, temp); Block block = prepareBlock(context, self, currDynScope, temp); String methodName = methAddr.getName(); RubyModule definingModule = (RubyModule) getDefiningModule().retrieve(context, self, currDynScope, temp); RubyClass superClass = definingModule.getMetaClass().getSuperClass(); DynamicMethod method = superClass != null ? superClass.searchMethod(methodName) : UndefinedMethod.INSTANCE; Object rVal = method.isUndefined() ? Helpers.callMethodMissing(context, self, method.getVisibility(), methodName, CallType.SUPER, args, block) : method.call(context, self, superClass, methodName, args, block); return hasUnusedResult() ? null : rVal; }
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block aBlock) { IRubyObject[] args = prepareArguments(context, self, getCallArgs(), currDynScope, temp); Block block = prepareBlock(context, self, currDynScope, temp); String methodName = methAddr.getName(); RubyModule definingModule = (RubyModule) getDefiningModule().retrieve(context, self, currDynScope, temp); RubyClass superClass = definingModule.getMetaClass().getSuperClass(); DynamicMethod method = superClass != null ? superClass.searchMethod(methodName) : UndefinedMethod.INSTANCE; Object rVal = method.isUndefined() ? Helpers.callMethodMissing(context, self, method.getVisibility(), methodName, CallType.SUPER, args, block) : method.call(context, self, superClass, methodName, args, block); return hasUnusedResult() ? null : rVal; }