Exemple #1
0
 public void preClassEval(StaticScope staticScope, RubyModule type) {
   pushRubyClass(type);
   pushFrameCopy();
   getCurrentFrame().setSelf(type);
   getCurrentFrame().setVisibility(Visibility.PUBLIC);
   pushScope(DynamicScope.newDynamicScope(staticScope, null));
 }
Exemple #2
0
 public void preCompiledClass(RubyModule type, StaticScope staticScope) {
   pushRubyClass(type);
   pushFrameCopy();
   getCurrentFrame().setSelf(type);
   getCurrentFrame().setVisibility(Visibility.PUBLIC);
   staticScope.setModule(type);
   pushScope(DynamicScope.newDynamicScope(staticScope));
 }
Exemple #3
0
 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);
 }
Exemple #4
0
  // 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());
  }
Exemple #5
0
 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);
 }
Exemple #6
0
 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;
 }
Exemple #7
0
 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;
 }
Exemple #8
0
 public void preScopeNode(StaticScope staticScope) {
   pushScope(DynamicScope.newDynamicScope(staticScope, getCurrentScope()));
 }