@Override public Instr clone(CloneInfo ii) { return new UnresolvedSuperInstr(ii.getScope(), Operation.UNRESOLVED_SUPER, ii.getRenamedVariable(getResult()), getReceiver().cloneForInlining(ii), cloneCallArgs(ii), getClosureArg() == null ? null : getClosureArg().cloneForInlining(ii), isPotentiallyRefined(), getCallSite(), getCallSiteId()); }
@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); return interpretSuper(context, self, args, block); }
@Override public boolean computeScopeFlags(IRScope scope) { super.computeScopeFlags(scope); scope.getFlags().add(IRFlags.USES_ZSUPER); return true; }
@Override public void UnresolvedSuperInstr(UnresolvedSuperInstr unresolvedsuperinstr) { String name = unresolvedsuperinstr.getId(); Operand[] args = unresolvedsuperinstr.getCallArgs(); // this would be getDefiningModule but that is not used for unresolved super Operand definingModule = UndefinedValue.UNDEFINED; boolean[] splatMap = unresolvedsuperinstr.splatMap(); Operand closure = unresolvedsuperinstr.getClosureArg(null); superCommon(name, unresolvedsuperinstr, args, definingModule, splatMap, closure); }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new UnresolvedSuperInstr(ii.getRenamedVariable(getResult()), getReceiver().cloneForInlining(ii), cloneCallArgs(ii), closure == null ? null : closure.cloneForInlining(ii)); }
private Operand buildSuperInScriptBody(IRScope s) { Variable ret = s.getNewTemporaryVariable(); s.addInstr(new UnresolvedSuperInstr(ret, getSelf(s), NO_ARGS, null)); return ret; }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { IRubyObject[] args = prepareArguments(context, self, currScope, currDynScope, temp); Block block = prepareBlock(context, self, currScope, currDynScope, temp); return IRRuntimeHelpers.unresolvedSuper(context, self, args, block); }
protected Object interpretSuper(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) { RubyBasicObject objClass = context.runtime.getObject(); // We have to rely on the frame stack to find the implementation class RubyModule klazz = context.getFrameKlazz(); String methodName = context.getCurrentFrame().getName(); checkSuperDisabledOrOutOfMethod(context, klazz, methodName); RubyClass superClass = Helpers.findImplementerIfNecessary(self.getMetaClass(), klazz).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; }
case TOGGLE_BACKTRACE: return ToggleBacktraceInstr.decode(this); case UNDEF_METHOD: return UndefMethodInstr.decode(this); case UNRESOLVED_SUPER: return UnresolvedSuperInstr.decode(this); case YIELD: return YieldInstr.decode(this); case ZSUPER: return ZSuperInstr.decode(this);
@Override public Instr cloneForInlining(InlinerInfo ii) { return new UnresolvedSuperInstr(ii.getRenamedVariable(getResult()), getReceiver().cloneForInlining(ii), cloneCallArgs(ii), closure == null ? null : closure.cloneForInlining(ii)); }
@Override public void UnresolvedSuperInstr(UnresolvedSuperInstr unresolvedsuperinstr) { String name = unresolvedsuperinstr.getId(); Operand[] args = unresolvedsuperinstr.getCallArgs(); // this would be getDefiningModule but that is not used for unresolved super Operand definingModule = UndefinedValue.UNDEFINED; boolean[] splatMap = unresolvedsuperinstr.splatMap(); Operand closure = unresolvedsuperinstr.getClosureArg(null); superCommon(name, unresolvedsuperinstr, args, definingModule, splatMap, closure); }
private Operand buildSuperInScriptBody(IRScope s) { Variable ret = s.getNewTemporaryVariable(); s.addInstr(new UnresolvedSuperInstr(ret, getSelf(s), NO_ARGS, null)); return ret; }
@Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { IRubyObject[] args = prepareArguments(context, self, currScope, currDynScope, temp); Block block = prepareBlock(context, self, currScope, currDynScope, temp); return IRRuntimeHelpers.unresolvedSuper(context, self, args, block); }
protected Object interpretSuper(ThreadContext context, IRubyObject self, IRubyObject[] args, Block block) { RubyBasicObject objClass = context.runtime.getObject(); // We have to rely on the frame stack to find the implementation class RubyModule klazz = context.getFrameKlazz(); String methodName = context.getCurrentFrame().getName(); checkSuperDisabledOrOutOfMethod(context, klazz, methodName); RubyClass superClass = Helpers.findImplementerIfNecessary(self.getMetaClass(), klazz).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; }
case TOGGLE_BACKTRACE: return ToggleBacktraceInstr.decode(this); case UNDEF_METHOD: return UndefMethodInstr.decode(this); case UNRESOLVED_SUPER: return UnresolvedSuperInstr.decode(this); case YIELD: return YieldInstr.decode(this); case ZSUPER: return ZSuperInstr.decode(this);
@Override public Instr clone(CloneInfo ii) { return new UnresolvedSuperInstr(ii.getScope(), Operation.UNRESOLVED_SUPER, ii.getRenamedVariable(getResult()), getReceiver().cloneForInlining(ii), cloneCallArgs(ii), getClosureArg() == null ? null : getClosureArg().cloneForInlining(ii), isPotentiallyRefined(), getCallSite(), getCallSiteId()); }
@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); return interpretSuper(context, self, args, block); }
private Operand buildSuperInScriptBody() { return addResultInstr(new UnresolvedSuperInstr(scope, createTemporaryVariable(), buildSelf(), NO_ARGS, null, scope.maybeUsingRefinements())); }
@Override public boolean computeScopeFlags(IRScope scope) { super.computeScopeFlags(scope); scope.getFlags().add(IRFlags.USES_ZSUPER); return true; }
private Operand buildSuperInScriptBody() { return addResultInstr(new UnresolvedSuperInstr(scope, createTemporaryVariable(), buildSelf(), NO_ARGS, null, scope.maybeUsingRefinements())); }