org.jrubyparser.ast
Class ArgsNode

java.lang.Object
  extended by org.jrubyparser.ast.Node
      extended by org.jrubyparser.ast.ArgsNode
All Implemented Interfaces:
ISourcePositionHolder

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  ArgumentNode rest
           
 
Constructor Summary
ArgsNode(SourcePosition position, ListNode pre, ListNode optional, RestArgNode rest, ListNode post, ListNode keywords, KeywordRestArgNode keywordRest, BlockArgNode block)
           
 
Method Summary
 Object accept(NodeVisitor iVisitor)
          Accept for the visitor pattern.
 BlockArgNode getBlock()
          Gets the explicit block argument of the parameter list (&block).
 int getMaxArgumentsCount()
           
 NodeType getNodeType()
           
 List<Node> getNormativeParameterList()
           
 List<String> getNormativeParameterNameList(boolean namesOnly)
          Return a list of all possible parameter names.
 ListNode getOptional()
          Gets the optional Arguments.
 int getOptionalCount()
           
 ListNode getPost()
           
 int getPostCount()
           
 ListNode getPre()
          Gets the required arguments at the beginning of the argument definition
 int getPreCount()
           
 int getRequiredCount()
           
 ArgumentNode getRest()
          Gets the rest node.
 boolean isSame(Node node)
          Checks node for 'sameness' for diffing.
 
Methods inherited from class org.jrubyparser.ast.Node
adopt, adopt, adoptUsingNodesPosition, childNodes, comparePositionWith, createList, getClosestIScope, getClosestModule, getGrandParent, getInlineComment, getInnermostIter, getMethodFor, getNodeAt, getNodeName, getOutermostIter, getParent, getPosition, getPositionIncludingComments, getPreviousComments, insertAfter, insertAll, insertBefore, insertNode, isBlockParameter, isDescendentOf, isLeaf, isMethodParameter, setParent, setPosition, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rest

protected ArgumentNode rest
Constructor Detail

ArgsNode

public ArgsNode(SourcePosition position,
                ListNode pre,
                ListNode optional,
                RestArgNode rest,
                ListNode post,
                ListNode keywords,
                KeywordRestArgNode keywordRest,
                BlockArgNode block)
Parameters:
position - of the arguments
pre - Required nodes at the beginning of the method definition
optional - Node describing the optional arguments
rest - The rest argument (*args).
post - Required nodes at the end of the method definition
block - An optional block argument (&arg).
Method Detail

isSame

public boolean isSame(Node node)
Checks node for 'sameness' for diffing.

Overrides:
isSame in class Node
Parameters:
node - to be compared to
Returns:
Returns a boolean

getNodeType

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

accept

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

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

getPreCount

public int getPreCount()

getOptionalCount

public int getOptionalCount()

getPostCount

public int getPostCount()

getRequiredCount

public int getRequiredCount()

getMaxArgumentsCount

public int getMaxArgumentsCount()

getOptional

public ListNode getOptional()
Gets the optional Arguments.

Returns:
Returns a ListNode

getPost

public ListNode getPost()

getPre

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


getRest

public ArgumentNode getRest()
Gets the rest node.

Returns:
Returns an ArgumentNode

getBlock

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

Returns:
Returns a BlockArgNode

getNormativeParameterNameList

public List<String> getNormativeParameterNameList(boolean namesOnly)
Return a list of all possible parameter names. IDE's can use this to generate indexes or use it for parameter hinting.

Parameters:
namesOnly - do not prepend '*', '**', or '&' onto front of special parameters

getNormativeParameterList

public List<Node> getNormativeParameterList()
Returns:
list of all parameters within this args node


Copyright © 2013. All Rights Reserved.