Package org.jruby.ast

Class ArgsNode

java.lang.Object
org.jruby.ast.Node
org.jruby.ast.ArgsNode

public class ArgsNode extends Node
Represents the argument declarations of a method. The fields: foo(p1, ..., pn, o1 = v1, ..., on = v2, *r, q1, ..., qn, k1:, ..., kn:, **K, &b) p1...pn = pre arguments o1...on = optional arguments r = rest argument q1...qn = post arguments (only in 1.9) k1...kn = keyword arguments K = keyword rest argument b = block arg
  • Field Details

    • restArgNode

      protected final RestArgNode restArgNode
  • Constructor Details

  • Method Details

    • isEmpty

      public boolean isEmpty()
    • getArgs

      public Node[] getArgs()
    • getOptArgIndex

      public int getOptArgIndex()
    • getPostIndex

      public int getPostIndex()
    • getKeywordsIndex

      public int getKeywordsIndex()
    • getNodeType

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

      public boolean cannotAcceptKwargs()
    • hasKwargs

      public boolean hasKwargs()
    • accept

      public <T> T accept(NodeVisitor<T> 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
    • getRequiredArgsCount

      public int getRequiredArgsCount()
    • getOptionalArgsCount

      public int getOptionalArgsCount()
    • getPost

      public ListNode getPost()
    • getOptArgs

      public ListNode getOptArgs()
      Gets the optArgs.
      Returns:
      Returns a ListNode
    • getRestArgNode

      public RestArgNode getRestArgNode()
      Gets the restArgNode.
      Returns:
      Returns an ArgumentNode
    • hasRestArg

      public boolean hasRestArg()
    • getBlock

      public BlockArgNode getBlock()
      Gets the explicit block argument of the parameter list (&block).
      Returns:
      Returns a BlockArgNode
    • getPostCount

      public int getPostCount()
    • getPreCount

      public int getPreCount()
    • getKeywords

      public ListNode getKeywords()
    • getKeyRest

      public KeywordRestArgNode getKeyRest()
    • hasKeyRest

      public boolean hasKeyRest()
    • childNodes

      public List<Node> childNodes()
      Specified by:
      childNodes in class Node
    • getKeywordCount

      public int getKeywordCount()
    • getRequiredKeywordCount

      public int getRequiredKeywordCount()
      How many of the keywords listed happen to be required keyword args. Note: total kwargs - req kwarg = opt kwargs.