org.jruby.runtime
Class InterpretedBlock

java.lang.Object
  extended by org.jruby.runtime.BlockBody
      extended by org.jruby.runtime.InterpretedBlock
All Implemented Interfaces:
JumpTarget
Direct Known Subclasses:
SharedScopeBlock

public class InterpretedBlock
extends BlockBody

Internal live representation of a block ({...} or do ... end).


Field Summary
protected  Arity arity
           
 
Fields inherited from class org.jruby.runtime.BlockBody
argumentType, ARRAY, MULTIPLE_ASSIGNMENT, NULL_BODY, SINGLE_RESTARG, ZERO_ARGS
 
Constructor Summary
InterpretedBlock(IterNode iterNode, Arity arity, int argumentType)
           
InterpretedBlock(IterNode iterNode, int argumentType)
           
 
Method Summary
 Arity arity()
          What is the arity of this block?
protected  int arrayLength(IRubyObject node)
           
 IRubyObject call(ThreadContext context, IRubyObject[] args, Binding binding, Block.Type type)
           
 Block cloneBlock(Binding binding)
           
 IterNode getIterNode()
           
 StaticScope getStaticScope()
           
 boolean isGiven()
          Is the current block a real yield'able block instead a null one
static Block newInterpretedClosure(IterNode iterNode, IRubyObject self, Arity arity, Frame frame, Visibility visibility, RubyModule klass, DynamicScope dynamicScope)
           
static Block newInterpretedClosure(ThreadContext context, InterpretedBlock body, IRubyObject self)
           
static Block newInterpretedClosure(ThreadContext context, IterNode iterNode, IRubyObject self)
           
protected  void post(ThreadContext context, Binding binding)
           
protected  void pre(ThreadContext context, RubyModule klass, Binding binding)
           
 IRubyObject yield(ThreadContext context, IRubyObject value, Binding binding, Block.Type type)
           
 IRubyObject yield(ThreadContext context, IRubyObject value, IRubyObject self, RubyModule klass, boolean aValue, Binding binding, Block.Type type)
          Yield to this block, usually passed to the current call.
 
Methods inherited from class org.jruby.runtime.BlockBody
asArgumentType, getArgumentTypeWackyHack, prepareArgumentsForCall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

arity

protected final Arity arity
Constructor Detail

InterpretedBlock

public InterpretedBlock(IterNode iterNode,
                        int argumentType)

InterpretedBlock

public InterpretedBlock(IterNode iterNode,
                        Arity arity,
                        int argumentType)
Method Detail

newInterpretedClosure

public static Block newInterpretedClosure(ThreadContext context,
                                          IterNode iterNode,
                                          IRubyObject self)

newInterpretedClosure

public static Block newInterpretedClosure(ThreadContext context,
                                          InterpretedBlock body,
                                          IRubyObject self)

newInterpretedClosure

public static Block newInterpretedClosure(IterNode iterNode,
                                          IRubyObject self,
                                          Arity arity,
                                          Frame frame,
                                          Visibility visibility,
                                          RubyModule klass,
                                          DynamicScope dynamicScope)

call

public IRubyObject call(ThreadContext context,
                        IRubyObject[] args,
                        Binding binding,
                        Block.Type type)
Specified by:
call in class BlockBody

pre

protected void pre(ThreadContext context,
                   RubyModule klass,
                   Binding binding)

post

protected void post(ThreadContext context,
                    Binding binding)

yield

public IRubyObject yield(ThreadContext context,
                         IRubyObject value,
                         Binding binding,
                         Block.Type type)
Specified by:
yield in class BlockBody

yield

public IRubyObject yield(ThreadContext context,
                         IRubyObject value,
                         IRubyObject self,
                         RubyModule klass,
                         boolean aValue,
                         Binding binding,
                         Block.Type type)
Yield to this block, usually passed to the current call.

Specified by:
yield in class BlockBody
Parameters:
context - represents the current thread-specific data
value - The value to yield, either a single value or an array of values
self - The current self
klass -
aValue - Should value be arrayified or not?
Returns:

arrayLength

protected int arrayLength(IRubyObject node)
Overrides:
arrayLength in class BlockBody

getStaticScope

public StaticScope getStaticScope()
Specified by:
getStaticScope in class BlockBody

cloneBlock

public Block cloneBlock(Binding binding)
Specified by:
cloneBlock in class BlockBody

getIterNode

public IterNode getIterNode()

arity

public Arity arity()
What is the arity of this block?

Specified by:
arity in class BlockBody
Returns:
the arity

isGiven

public boolean isGiven()
Is the current block a real yield'able block instead a null one

Overrides:
isGiven in class BlockBody
Returns:
true if this is a valid block or false otherwise


Copyright © 2002-2007 JRuby Team. All Rights Reserved.