public Binding(Frame frame, DynamicScope dynamicScope, String method, String filename, int line) { assert frame != null; this.self = frame.getSelf(); this.frame = frame; this.visibility = frame.getVisibility(); this.dynamicScope = dynamicScope; this.method = method; this.filename = filename; this.line = line; }
@Deprecated public Binding(Frame frame, DynamicScope dynamicScope, BacktraceElement backtrace) { this.self = frame.getSelf(); this.frame = frame; this.visibility = frame.getVisibility(); this.dynamicScope = dynamicScope; this.method = backtrace.method; this.filename = backtrace.filename; this.line = backtrace.line; }
public Binding(Frame frame, DynamicScope dynamicScope, String method, String filename, int line) { assert frame != null; this.self = frame.getSelf(); this.frame = frame; this.visibility = frame.getVisibility(); this.dynamicScope = dynamicScope; this.method = method; this.filename = filename; this.line = line; }
public Binding(Frame frame, RubyModule bindingClass, DynamicScope dynamicScope, BacktraceElement backtrace) { this.self = frame.getSelf(); this.frame = frame; this.visibility = frame.getVisibility(); this.klass = bindingClass; this.dynamicScope = dynamicScope; this.backtrace = backtrace; }
@Deprecated public Binding(Frame frame, DynamicScope dynamicScope, BacktraceElement backtrace) { this.self = frame.getSelf(); this.frame = frame; this.visibility = frame.getVisibility(); this.dynamicScope = dynamicScope; this.method = backtrace.method; this.filename = backtrace.filename; this.line = backtrace.line; }
public Binding(Frame frame, RubyModule bindingClass, DynamicScope dynamicScope, BacktraceElement backtrace) { this.self = frame.getSelf(); this.frame = frame; this.visibility = frame.getVisibility(); this.klass = bindingClass; this.dynamicScope = dynamicScope; this.backtrace = backtrace; }
public IRubyObject getFrameSelf() { return getCurrentFrame().getSelf(); }
public IRubyObject getFrameSelf() { return getCurrentFrame().getSelf(); }
public IRubyObject getFrameSelf() { return getCurrentFrame().getSelf(); }
public IRubyObject getFrameSelf() { return getCurrentFrame().getSelf(); }
private Visibility getCurrentVisibilityForDefineMethod(ThreadContext context) { // These checks are similar to rb_vm_cref_in_context from MRI. return context.getCurrentFrame().getSelf() == this ? context.getCurrentVisibility() : PUBLIC; }
private Visibility getCurrentVisibilityForDefineMethod(ThreadContext context) { // These checks are similar to rb_vm_cref_in_context from MRI. return context.getCurrentFrame().getSelf() == this ? context.getCurrentVisibility() : PUBLIC; }
public void preExecuteUnder(RubyModule executeUnderClass, Block block) { Frame frame = getCurrentFrame(); pushRubyClass(executeUnderClass); DynamicScope scope = getCurrentScope(); StaticScope sScope = runtime.getStaticScopeFactory().newBlockScope(scope.getStaticScope()); sScope.setModule(executeUnderClass); pushScope(DynamicScope.newDynamicScope(sScope, scope)); pushCallFrame(frame.getKlazz(), frame.getName(), frame.getSelf(), block); getCurrentFrame().setVisibility(getPreviousFrame().getVisibility()); }
public void preExecuteUnder(RubyModule executeUnderClass, Block block) { Frame frame = getCurrentFrame(); pushRubyClass(executeUnderClass); DynamicScope scope = getCurrentScope(); StaticScope sScope = runtime.getStaticScopeFactory().newBlockScope(scope.getStaticScope()); sScope.setModule(executeUnderClass); pushScope(DynamicScope.newDynamicScope(sScope, scope)); pushCallFrame(frame.getKlazz(), frame.getName(), frame.getSelf(), block); getCurrentFrame().setVisibility(getPreviousFrame().getVisibility()); }
/** * Will yield to the specific block changing the self to be the * current object instead of the self that is part of the frame * saved in the block frame. This method is the basis for the Ruby * instance_eval and module_eval methods. The arguments sent in to * it in the args array will be yielded to the block. This makes * it possible to emulate both instance_eval and instance_exec * with this implementation. */ protected IRubyObject yieldUnder(final ThreadContext context, RubyModule under, IRubyObject[] args, Block block, EvalType evalType) { context.preExecuteUnder(this, under, block); IRubyObject savedBindingSelf = block.getBinding().getSelf(); IRubyObject savedFrameSelf = block.getBinding().getFrame().getSelf(); Visibility savedVisibility = block.getBinding().getVisibility(); block.getBinding().setVisibility(PUBLIC); try { if (args.length == 1) { IRubyObject valueInYield = args[0]; return setupBlock(block, evalType).yieldNonArray(context, valueInYield, this); // context.getRubyClass()); } else { IRubyObject valueInYield = RubyArray.newArrayMayCopy(context.runtime, args); return setupBlock(block, evalType).yieldArray(context, valueInYield, this); // context.getRubyClass()); } } finally { block.getBinding().setVisibility(savedVisibility); block.getBinding().setSelf(savedBindingSelf); block.getBinding().getFrame().setSelf(savedFrameSelf); context.postExecuteUnder(); } }
/** * Will yield to the specific block changing the self to be the * current object instead of the self that is part of the frame * saved in the block frame. This method is the basis for the Ruby * instance_eval and module_eval methods. The arguments sent in to * it in the args array will be yielded to the block. This makes * it possible to emulate both instance_eval and instance_exec * with this implementation. */ protected IRubyObject yieldUnder(final ThreadContext context, RubyModule under, IRubyObject[] args, Block block, EvalType evalType) { context.preExecuteUnder(this, under, block); IRubyObject savedBindingSelf = block.getBinding().getSelf(); IRubyObject savedFrameSelf = block.getBinding().getFrame().getSelf(); Visibility savedVisibility = block.getBinding().getVisibility(); block.getBinding().setVisibility(PUBLIC); try { if (args.length == 1) { IRubyObject valueInYield = args[0]; return setupBlock(block, evalType).yieldNonArray(context, valueInYield, this); // context.getRubyClass()); } else { IRubyObject valueInYield = RubyArray.newArrayMayCopy(context.runtime, args); return setupBlock(block, evalType).yieldArray(context, valueInYield, this); // context.getRubyClass()); } } finally { block.getBinding().setVisibility(savedVisibility); block.getBinding().setSelf(savedBindingSelf); block.getBinding().getFrame().setSelf(savedFrameSelf); context.postExecuteUnder(); } }