@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { Ruby runtime = context.runtime; IRubyObject obj = (IRubyObject)object.retrieve(context, self, currDynScope, temp); RubyClass singletonClass = Helpers.getSingletonClass(runtime, obj); metaClassBody.getStaticScope().setModule(singletonClass); return new InterpretedIRMethod(metaClassBody, Visibility.PUBLIC, singletonClass); }
public void emit(IRModuleBody method) { String name = method.getName(); if (name.indexOf("DUMMY_MC") != -1) { name = "METACLASS"; } name = emitScope(method, name, 0); // push a method handle for binding purposes jvm.method().pushHandle(jvm.clsData().clsName, name, method.getStaticScope().getRequiredArgs()); }
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { Ruby runtime = context.runtime; IRubyObject obj = (IRubyObject)object.retrieve(context, self, currDynScope, temp); RubyClass singletonClass = Helpers.getSingletonClass(runtime, obj); metaClassBody.getStaticScope().setModule(singletonClass); return new InterpretedIRMethod(metaClassBody, Visibility.PUBLIC, singletonClass); }
public void emit(IRModuleBody method) { String name = method.getName(); if (name.indexOf("DUMMY_MC") != -1) { name = "METACLASS"; } name = emitScope(method, name, 0); // push a method handle for binding purposes jvm.method().pushHandle(jvm.clsData().clsName, name, method.getStaticScope().getRequiredArgs()); }
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { Object rubyContainer = container.retrieve(context, self, currDynScope, temp); if (!(rubyContainer instanceof RubyModule)) { throw context.runtime.newTypeError("no outer class/module"); } RubyModule newRubyModule = ((RubyModule) rubyContainer).defineOrGetModuleUnder(newIRModuleBody.getName()); newIRModuleBody.getStaticScope().setModule(newRubyModule); return new InterpretedIRMethod(newIRModuleBody, Visibility.PUBLIC, newRubyModule); }
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { Object rubyContainer = container.retrieve(context, self, currDynScope, temp); if (!(rubyContainer instanceof RubyModule)) { throw context.runtime.newTypeError("no outer class/module"); } RubyModule newRubyModule = ((RubyModule) rubyContainer).defineOrGetModuleUnder(newIRModuleBody.getName()); newIRModuleBody.getStaticScope().setModule(newRubyModule); return new InterpretedIRMethod(newIRModuleBody, Visibility.PUBLIC, newRubyModule); }
@Override public void DefineMetaClassInstr(DefineMetaClassInstr definemetaclassinstr) { IRModuleBody metaClassBody = definemetaclassinstr.getMetaClassBody(); StaticScope scope = metaClassBody.getStaticScope(); if (scope.getRequiredArgs() > 3 || scope.getRestArg() >= 0 || scope.getOptionalArgs() != 0) { throw new RuntimeException("can't compile variable method: " + this);
@Override public void DefineMetaClassInstr(DefineMetaClassInstr definemetaclassinstr) { IRModuleBody metaClassBody = definemetaclassinstr.getMetaClassBody(); StaticScope scope = metaClassBody.getStaticScope(); if (scope.getRequiredArgs() > 3 || scope.getRestArg() >= 0 || scope.getOptionalArgs() != 0) { throw new RuntimeException("can't compile variable method: " + this);
@Override public void DefineModuleInstr(DefineModuleInstr definemoduleinstr) { IRModuleBody newIRModuleBody = definemoduleinstr.getNewIRModuleBody(); StaticScope scope = newIRModuleBody.getStaticScope(); if (scope.getRequiredArgs() > 3 || scope.getRestArg() >= 0 || scope.getOptionalArgs() != 0) { throw new RuntimeException("can't compile variable method: " + this);
@Override public void DefineModuleInstr(DefineModuleInstr definemoduleinstr) { IRModuleBody newIRModuleBody = definemoduleinstr.getNewIRModuleBody(); StaticScope scope = newIRModuleBody.getStaticScope(); if (scope.getRequiredArgs() > 3 || scope.getRestArg() >= 0 || scope.getOptionalArgs() != 0) { throw new RuntimeException("can't compile variable method: " + this);