public void preClassEval(StaticScope staticScope, RubyModule type) { pushRubyClass(type); pushFrameCopy(); getCurrentFrame().setSelf(type); getCurrentFrame().setVisibility(Visibility.PUBLIC); pushScope(DynamicScope.newDynamicScope(staticScope, null)); }
public void preCompiledClass(RubyModule type, StaticScope staticScope) { pushRubyClass(type); pushFrameCopy(); getCurrentFrame().setSelf(type); getCurrentFrame().setVisibility(Visibility.PUBLIC); staticScope.setModule(type); pushScope(DynamicScope.newDynamicScope(staticScope)); }
public void preMethodScopeOnly(RubyModule clazz, StaticScope staticScope) { RubyModule implementationClass = staticScope.getModule(); // FIXME: This is currently only here because of some problems with IOOutputStream writing to a // "bare" runtime without a proper scope if (implementationClass == null) { implementationClass = clazz; } pushScope(DynamicScope.newDynamicScope(staticScope)); pushRubyClass(implementationClass); }
// XXX: Again, screwy evaling under previous frame's scope public void preExecuteUnder(RubyModule executeUnderClass, Block block) { Frame frame = getCurrentFrame(); pushRubyClass(executeUnderClass); DynamicScope scope = getCurrentScope(); StaticScope sScope = new BlockStaticScope(scope.getStaticScope()); sScope.setModule(executeUnderClass); pushScope(DynamicScope.newDynamicScope(sScope, scope)); pushCallFrame(frame.getKlazz(), frame.getName(), frame.getSelf(), block); getCurrentFrame().setVisibility(getPreviousFrame().getVisibility()); }
public void preMethodFrameAndScope( RubyModule clazz, String name, IRubyObject self, Block block, StaticScope staticScope) { RubyModule implementationClass = staticScope.getModule(); // FIXME: This is currently only here because of some problems with IOOutputStream writing to a // "bare" runtime without a proper scope if (implementationClass == null) { implementationClass = clazz; } pushCallFrame(clazz, name, self, block); pushScope(DynamicScope.newDynamicScope(staticScope)); pushRubyClass(implementationClass); }
public DynamicScope allocScope(DynamicScope parentScope) { // SSS: Important! Use getStaticScope() to use a copy of the static-scope stored in the // block-body. // Do not use 'closure.getStaticScope()' -- that returns the original copy of the static scope. // This matters because blocks created for Thread bodies modify the static-scope field of the // block-body // that records additional state about the block body. // // FIXME: Rather than modify static-scope, it seems we ought to set a field in block-body which // is then // used to tell dynamic-scope that it is a dynamic scope for a thread body. Anyway, to be // revisited later! EvalType evalType = ((IRBlockBody) body).getEvalType(); DynamicScope newScope = DynamicScope.newDynamicScope(body.getStaticScope(), parentScope, evalType); if (type == Block.Type.LAMBDA) newScope.setLambda(true); return newScope; }
public Frame preYieldSpecificBlock(Binding binding, StaticScope scope, RubyModule klass) { Frame lastFrame = preYieldNoScope(binding, klass); // new scope for this invocation of the block, based on parent scope pushScope(DynamicScope.newDynamicScope(scope, binding.getDynamicScope())); return lastFrame; }
public void preScopeNode(StaticScope staticScope) { pushScope(DynamicScope.newDynamicScope(staticScope, getCurrentScope())); }