Package org.jruby.ast
Class ArgsNode
java.lang.Object
org.jruby.ast.Node
org.jruby.ast.ArgsNode
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 Summary
FieldsFields inherited from class org.jruby.ast.Node
containsVariableAssignment, newline
-
Constructor Summary
ConstructorsConstructorDescriptionArgsNode
(int line, ListNode pre, ListNode optionalArguments, RestArgNode rest, ListNode post, BlockArgNode blockArgNode) Construct a new ArgsNode with no keyword arguments.ArgsNode
(int line, ListNode pre, ListNode optionalArguments, RestArgNode rest, ListNode post, ListNode keywords, KeywordRestArgNode keyRest, BlockArgNode blockArgNode) Construct a new ArgsNode with keyword arguments. -
Method Summary
Modifier and TypeMethodDescription<T> T
accept
(NodeVisitor<T> iVisitor) Accept for the visitor pattern.boolean
Node[]
getArgs()
getBlock()
Gets the explicit block argument of the parameter list (&block).int
int
int
Gets the optArgs.int
getPost()
int
int
getPre()
Gets the required arguments at the beginning of the argument definitionint
int
int
How many of the keywords listed happen to be required keyword args.Gets the restArgNode.boolean
boolean
boolean
boolean
isEmpty()
Methods inherited from class org.jruby.ast.Node
containsVariableAssignment, createList, createList, createList, createList, executesOnce, getFile, getLine, getNodeName, isNewline, isNil, needsDefinitionCheck, setLine, setNewline, toString, toString, toStringExtraInfo, toStringInternal, unsetNewline
-
Field Details
-
restArgNode
-
-
Constructor Details
-
ArgsNode
public ArgsNode(int line, ListNode pre, ListNode optionalArguments, RestArgNode rest, ListNode post, BlockArgNode blockArgNode) Construct a new ArgsNode with no keyword arguments. -
ArgsNode
public ArgsNode(int line, ListNode pre, ListNode optionalArguments, RestArgNode rest, ListNode post, ListNode keywords, KeywordRestArgNode keyRest, BlockArgNode blockArgNode) Construct a new ArgsNode with keyword arguments.
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
getArgs
-
getOptArgIndex
public int getOptArgIndex() -
getPostIndex
public int getPostIndex() -
getKeywordsIndex
public int getKeywordsIndex() -
getNodeType
- Specified by:
getNodeType
in classNode
- Returns:
- the nodeId
-
cannotAcceptKwargs
public boolean cannotAcceptKwargs() -
hasKwargs
public boolean hasKwargs() -
accept
Accept for the visitor pattern. -
getPre
Gets the required arguments at the beginning of the argument definition -
getRequiredArgsCount
public int getRequiredArgsCount() -
getOptionalArgsCount
public int getOptionalArgsCount() -
getPost
-
getOptArgs
Gets the optArgs.- Returns:
- Returns a ListNode
-
getRestArgNode
Gets the restArgNode.- Returns:
- Returns an ArgumentNode
-
hasRestArg
public boolean hasRestArg() -
getBlock
Gets the explicit block argument of the parameter list (&block).- Returns:
- Returns a BlockArgNode
-
getPostCount
public int getPostCount() -
getPreCount
public int getPreCount() -
getKeywords
-
getKeyRest
-
hasKeyRest
public boolean hasKeyRest() -
childNodes
- Specified by:
childNodes
in classNode
-
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.
-