org.jruby.ast
Class ArgsNode

java.lang.Object
  extended by org.jruby.ast.Node
      extended by org.jruby.ast.ArgsNode
All Implemented Interfaces:
ISourcePositionHolder
Direct Known Subclasses:
ArgsNoArgNode, ArgsPreOneArgNode, ArgsPreTwoArgNode

public class ArgsNode
extends Node

Represents the argument declarations of a method. The fields: foo(p1, ..., pn, o1 = v1, ..., on = v2, *r, q1, ..., qn) p1...pn = pre arguments o1...on = optional arguments r = rest argument q1...qn = post arguments (only in 1.9)


Field Summary
protected  Arity arity
           
protected  boolean hasMasgnArgs
           
protected  boolean hasOptArgs
           
protected  boolean isSimple
           
protected  int maxArgsCount
           
protected  int restArg
           
protected  ArgumentNode restArgNode
           
 
Fields inherited from class org.jruby.ast.Node
ASSIGNMENT_BYTELIST, CLASS_VARIABLE_BYTELIST, CONSTANT_BYTELIST, EXPRESSION_BYTELIST, FALSE_BYTELIST, GLOBAL_VARIABLE_BYTELIST, INSTANCE_VARIABLE_BYTELIST, LOCAL_VARIABLE_BYTELIST, LOCAL_VARIABLE_IN_BLOCK_BYTELIST, METHOD_BYTELIST, NIL_BYTELIST, SELF_BYTELIST, SUPER_BYTELIST, TRUE_BYTELIST, YIELD_BYTELIST
 
Constructor Summary
ArgsNode(ISourcePosition position, ListNode pre, ListNode optionalArguments, RestArgNode rest, ListNode post, BlockArgNode blockArgNode)
           
 
Method Summary
 java.lang.Object accept(NodeVisitor iVisitor)
          Accept for the visitor pattern.
protected  int assignOptArgs(IRubyObject[] args, Ruby runtime, ThreadContext context, IRubyObject self, int givenArgsCount)
           
protected  Arity calculateArity()
           
 void checkArgCount(Ruby runtime, int argsLength)
           
 java.util.List<Node> childNodes()
           
 ListNode getArgs()
          Deprecated. 
 Arity getArity()
           
 BlockArgNode getBlock()
          Gets the explicit block argument of the parameter list (&block).
 BlockArgNode getBlockArgNode()
          Deprecated. 
 int getMaxArgumentsCount()
           
 NodeType getNodeType()
           
 ListNode getOptArgs()
          Gets the optArgs.
 int getOptionalArgsCount()
           
 ListNode getPost()
           
 int getPostCount()
           
 int getPostIndex()
           
 ListNode getPre()
          Gets the required arguments at the beginning of the argument definition
 int getPreCount()
           
 int getRequiredArgsCount()
           
 int getRestArg()
          Gets the restArg.
 ArgumentNode getRestArgNode()
          Gets the restArgNode.
protected  boolean hasMasgnArgs()
           
 void prepare(ThreadContext context, Ruby runtime, IRubyObject self, Block block)
           
 void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject[] args, Block block)
           
 void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, Block block)
           
 void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, Block block)
           
 void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
           
 void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, Block block)
           
 void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, Block block)
           
 void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, Block block)
           
 void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, Block block)
           
 void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, IRubyObject arg7, Block block)
           
 void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, IRubyObject arg7, IRubyObject arg8, Block block)
           
 void prepare(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, IRubyObject arg7, IRubyObject arg8, IRubyObject arg9, Block block)
           
protected  int prepareOptionalArguments(ThreadContext context, Ruby runtime, IRubyObject self, IRubyObject[] args)
           
protected  void prepareOptOrRestArgs(ThreadContext context, Ruby runtime, DynamicScope scope, IRubyObject self, IRubyObject[] args)
           
protected  void prepareRestArg(ThreadContext context, Ruby runtime, DynamicScope scope, IRubyObject[] args, int givenArgsCount)
           
protected  void processBlockArg(DynamicScope scope, Ruby runtime, Block block)
           
 
Methods inherited from class org.jruby.ast.Node
assign, createList, definition, getNodeName, getPosition, interpret, isInvisible, setPosition, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

restArgNode

protected final ArgumentNode restArgNode

restArg

protected final int restArg

arity

protected Arity arity

hasOptArgs

protected final boolean hasOptArgs

hasMasgnArgs

protected final boolean hasMasgnArgs

maxArgsCount

protected int maxArgsCount

isSimple

protected final boolean isSimple
Constructor Detail

ArgsNode

public ArgsNode(ISourcePosition position,
                ListNode pre,
                ListNode optionalArguments,
                RestArgNode rest,
                ListNode post,
                BlockArgNode blockArgNode)
Parameters:
optionalArguments - Node describing the optional arguments This Block will contain assignments to locals (LAsgnNode)
restArguments - index of the rest argument in the local table (the array argument prefixed by a * which collects all additional params) or -1 if there is none.
argsCount - number of regular arguments
restArgNode - The rest argument (*args).
blockArgNode - An optional block argument (&arg).
Method Detail

getNodeType

public NodeType getNodeType()
Specified by:
getNodeType in class Node
Returns:
the nodeId

calculateArity

protected Arity calculateArity()

hasMasgnArgs

protected boolean hasMasgnArgs()

accept

public java.lang.Object accept(NodeVisitor iVisitor)
Accept for the visitor pattern.

Specified by:
accept in class Node
Parameters:
iVisitor - the visitor

getPre

public ListNode getPre()
Gets the required arguments at the beginning of the argument definition


getArgs

@Deprecated
public ListNode getArgs()
Deprecated. 


getArity

public Arity getArity()

getRequiredArgsCount

public int getRequiredArgsCount()

getOptionalArgsCount

public int getOptionalArgsCount()

getPost

public ListNode getPost()

getMaxArgumentsCount

public int getMaxArgumentsCount()

getOptArgs

public ListNode getOptArgs()
Gets the optArgs.

Returns:
Returns a ListNode

getRestArg

public int getRestArg()
Gets the restArg.

Returns:
Returns a int

getRestArgNode

public ArgumentNode getRestArgNode()
Gets the restArgNode.

Returns:
Returns an ArgumentNode

getBlockArgNode

@Deprecated
public BlockArgNode getBlockArgNode()
Deprecated. 


getBlock

public BlockArgNode getBlock()
Gets the explicit block argument of the parameter list (&block).

Returns:
Returns a BlockArgNode

getPostCount

public int getPostCount()

getPostIndex

public int getPostIndex()

getPreCount

public int getPreCount()

prepare

public void prepare(ThreadContext context,
                    Ruby runtime,
                    IRubyObject self,
                    IRubyObject[] args,
                    Block block)

prepare

public void prepare(ThreadContext context,
                    Ruby runtime,
                    IRubyObject self,
                    Block block)

prepare

public void prepare(ThreadContext context,
                    Ruby runtime,
                    IRubyObject self,
                    IRubyObject arg0,
                    Block block)

prepare

public void prepare(ThreadContext context,
                    Ruby runtime,
                    IRubyObject self,
                    IRubyObject arg0,
                    IRubyObject arg1,
                    Block block)

prepare

public void prepare(ThreadContext context,
                    Ruby runtime,
                    IRubyObject self,
                    IRubyObject arg0,
                    IRubyObject arg1,
                    IRubyObject arg2,
                    Block block)

prepare

public void prepare(ThreadContext context,
                    Ruby runtime,
                    IRubyObject self,
                    IRubyObject arg0,
                    IRubyObject arg1,
                    IRubyObject arg2,
                    IRubyObject arg3,
                    Block block)

prepare

public void prepare(ThreadContext context,
                    Ruby runtime,
                    IRubyObject self,
                    IRubyObject arg0,
                    IRubyObject arg1,
                    IRubyObject arg2,
                    IRubyObject arg3,
                    IRubyObject arg4,
                    Block block)

prepare

public void prepare(ThreadContext context,
                    Ruby runtime,
                    IRubyObject self,
                    IRubyObject arg0,
                    IRubyObject arg1,
                    IRubyObject arg2,
                    IRubyObject arg3,
                    IRubyObject arg4,
                    IRubyObject arg5,
                    Block block)

prepare

public void prepare(ThreadContext context,
                    Ruby runtime,
                    IRubyObject self,
                    IRubyObject arg0,
                    IRubyObject arg1,
                    IRubyObject arg2,
                    IRubyObject arg3,
                    IRubyObject arg4,
                    IRubyObject arg5,
                    IRubyObject arg6,
                    Block block)

prepare

public void prepare(ThreadContext context,
                    Ruby runtime,
                    IRubyObject self,
                    IRubyObject arg0,
                    IRubyObject arg1,
                    IRubyObject arg2,
                    IRubyObject arg3,
                    IRubyObject arg4,
                    IRubyObject arg5,
                    IRubyObject arg6,
                    IRubyObject arg7,
                    Block block)

prepare

public void prepare(ThreadContext context,
                    Ruby runtime,
                    IRubyObject self,
                    IRubyObject arg0,
                    IRubyObject arg1,
                    IRubyObject arg2,
                    IRubyObject arg3,
                    IRubyObject arg4,
                    IRubyObject arg5,
                    IRubyObject arg6,
                    IRubyObject arg7,
                    IRubyObject arg8,
                    Block block)

prepare

public void prepare(ThreadContext context,
                    Ruby runtime,
                    IRubyObject self,
                    IRubyObject arg0,
                    IRubyObject arg1,
                    IRubyObject arg2,
                    IRubyObject arg3,
                    IRubyObject arg4,
                    IRubyObject arg5,
                    IRubyObject arg6,
                    IRubyObject arg7,
                    IRubyObject arg8,
                    IRubyObject arg9,
                    Block block)

checkArgCount

public void checkArgCount(Ruby runtime,
                          int argsLength)

prepareOptOrRestArgs

protected void prepareOptOrRestArgs(ThreadContext context,
                                    Ruby runtime,
                                    DynamicScope scope,
                                    IRubyObject self,
                                    IRubyObject[] args)

prepareOptionalArguments

protected int prepareOptionalArguments(ThreadContext context,
                                       Ruby runtime,
                                       IRubyObject self,
                                       IRubyObject[] args)

prepareRestArg

protected void prepareRestArg(ThreadContext context,
                              Ruby runtime,
                              DynamicScope scope,
                              IRubyObject[] args,
                              int givenArgsCount)

assignOptArgs

protected int assignOptArgs(IRubyObject[] args,
                            Ruby runtime,
                            ThreadContext context,
                            IRubyObject self,
                            int givenArgsCount)

processBlockArg

protected void processBlockArg(DynamicScope scope,
                               Ruby runtime,
                               Block block)

childNodes

public java.util.List<Node> childNodes()
Specified by:
childNodes in class Node


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