org.jruby.runtime
Class BlockBody

java.lang.Object
  extended by org.jruby.runtime.BlockBody
All Implemented Interfaces:
JumpTarget
Direct Known Subclasses:
CallBlock, CompiledBlock, CompiledBlockLight, InterpretedBlock, MethodBlock

public abstract class BlockBody
extends java.lang.Object
implements JumpTarget

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


Field Summary
protected  int argumentType
           
static int ARRAY
           
static int MULTIPLE_ASSIGNMENT
           
static BlockBody NULL_BODY
           
static int SINGLE_RESTARG
           
static int ZERO_ARGS
           
 
Constructor Summary
BlockBody(int argumentType)
           
 
Method Summary
abstract  Arity arity()
          What is the arity of this block?
protected  int arrayLength(IRubyObject node)
           
static int asArgumentType(NodeType nodeId)
          Compiled codes way of examining arguments
abstract  IRubyObject call(ThreadContext context, IRubyObject[] args, Binding binding, Block.Type type)
           
abstract  Block cloneBlock(Binding binding)
           
static NodeType getArgumentTypeWackyHack(IterNode iterNode)
           
abstract  StaticScope getStaticScope()
           
 boolean isGiven()
          Is the current block a real yield'able block instead a null one
 IRubyObject[] prepareArgumentsForCall(ThreadContext context, IRubyObject[] args, Block.Type type)
           
abstract  IRubyObject yield(ThreadContext context, IRubyObject value, Binding binding, Block.Type type)
           
abstract  IRubyObject yield(ThreadContext context, IRubyObject value, IRubyObject self, RubyModule klass, boolean aValue, Binding binding, Block.Type type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZERO_ARGS

public static final int ZERO_ARGS
See Also:
Constant Field Values

MULTIPLE_ASSIGNMENT

public static final int MULTIPLE_ASSIGNMENT
See Also:
Constant Field Values

ARRAY

public static final int ARRAY
See Also:
Constant Field Values

SINGLE_RESTARG

public static final int SINGLE_RESTARG
See Also:
Constant Field Values

argumentType

protected final int argumentType

NULL_BODY

public static final BlockBody NULL_BODY
Constructor Detail

BlockBody

public BlockBody(int argumentType)
Method Detail

call

public abstract IRubyObject call(ThreadContext context,
                                 IRubyObject[] args,
                                 Binding binding,
                                 Block.Type type)

yield

public abstract IRubyObject yield(ThreadContext context,
                                  IRubyObject value,
                                  Binding binding,
                                  Block.Type type)

yield

public abstract IRubyObject yield(ThreadContext context,
                                  IRubyObject value,
                                  IRubyObject self,
                                  RubyModule klass,
                                  boolean aValue,
                                  Binding binding,
                                  Block.Type type)

arrayLength

protected int arrayLength(IRubyObject node)

getStaticScope

public abstract StaticScope getStaticScope()

cloneBlock

public abstract Block cloneBlock(Binding binding)

arity

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

Returns:
the arity

isGiven

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

Returns:
true if this is a valid block or false otherwise

asArgumentType

public static int asArgumentType(NodeType nodeId)
Compiled codes way of examining arguments

Parameters:
nodeId - to be considered
Returns:
something not linked to AST and a constant to make compiler happy

prepareArgumentsForCall

public IRubyObject[] prepareArgumentsForCall(ThreadContext context,
                                             IRubyObject[] args,
                                             Block.Type type)

getArgumentTypeWackyHack

public static NodeType getArgumentTypeWackyHack(IterNode iterNode)


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