org.jruby.runtime
Class CompiledBlock

java.lang.Object
  extended by org.jruby.runtime.BlockBody
      extended by org.jruby.runtime.CompiledBlock
All Implemented Interfaces:
JumpTarget

public class CompiledBlock
extends BlockBody

A Block implemented using a Java-based BlockCallback implementation rather than with an ICallable. For lightweight block logic within Java code.


Field Summary
protected  Arity arity
           
protected  CompiledBlockCallback callback
           
protected  boolean hasMultipleArgsHead
           
protected  StaticScope scope
           
 
Fields inherited from class org.jruby.runtime.BlockBody
argumentType, ARRAY, MULTIPLE_ASSIGNMENT, NULL_BODY, SINGLE_RESTARG, ZERO_ARGS
 
Constructor Summary
protected CompiledBlock(Arity arity, StaticScope scope, CompiledBlockCallback callback, boolean hasMultipleArgsHead, int argumentType)
           
 
Method Summary
 Arity arity()
          What is the arity of this block?
 IRubyObject call(ThreadContext context, IRubyObject[] args, Binding binding, Block.Type type)
           
 Block cloneBlock(Binding binding)
           
 StaticScope getStaticScope()
           
static Block newCompiledClosure(IRubyObject self, Frame frame, Visibility visibility, RubyModule klass, DynamicScope dynamicScope, Arity arity, StaticScope scope, CompiledBlockCallback callback, boolean hasMultipleArgsHead, int argumentType)
           
static Block newCompiledClosure(ThreadContext context, IRubyObject self, Arity arity, StaticScope scope, CompiledBlockCallback callback, boolean hasMultipleArgsHead, int argumentType)
           
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 args, IRubyObject self, RubyModule klass, boolean aValue, Binding binding, Block.Type type)
           
 
Methods inherited from class org.jruby.runtime.BlockBody
arrayLength, asArgumentType, getArgumentTypeWackyHack, isGiven, prepareArgumentsForCall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

callback

protected final CompiledBlockCallback callback

hasMultipleArgsHead

protected final boolean hasMultipleArgsHead

arity

protected final Arity arity

scope

protected final StaticScope scope
Constructor Detail

CompiledBlock

protected CompiledBlock(Arity arity,
                        StaticScope scope,
                        CompiledBlockCallback callback,
                        boolean hasMultipleArgsHead,
                        int argumentType)
Method Detail

newCompiledClosure

public static Block newCompiledClosure(IRubyObject self,
                                       Frame frame,
                                       Visibility visibility,
                                       RubyModule klass,
                                       DynamicScope dynamicScope,
                                       Arity arity,
                                       StaticScope scope,
                                       CompiledBlockCallback callback,
                                       boolean hasMultipleArgsHead,
                                       int argumentType)

newCompiledClosure

public static Block newCompiledClosure(ThreadContext context,
                                       IRubyObject self,
                                       Arity arity,
                                       StaticScope scope,
                                       CompiledBlockCallback callback,
                                       boolean hasMultipleArgsHead,
                                       int argumentType)

call

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

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 args,
                         IRubyObject self,
                         RubyModule klass,
                         boolean aValue,
                         Binding binding,
                         Block.Type type)
Specified by:
yield in class BlockBody

pre

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

post

protected void post(ThreadContext context,
                    Binding binding)

getStaticScope

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

cloneBlock

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

arity

public Arity arity()
Description copied from class: BlockBody
What is the arity of this block?

Specified by:
arity in class BlockBody
Returns:
the arity


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