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
FieldsModifier and TypeFieldDescriptionprivate final Node[]private final BlockArgNodeprivate final KeywordRestArgNodeprivate final shortprivate static final Node[]private final shortprivate final shortprotected final RestArgNodeFields inherited from class org.jruby.ast.Node
containsVariableAssignment, EMPTY_LIST, 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> Taccept(NodeVisitor<T> iVisitor) Accept for the visitor pattern.Node[]getArgs()getBlock()Gets the explicit block argument of the parameter list (&block).intintintGets the optArgs.intgetPost()intintgetPre()Gets the required arguments at the beginning of the argument definitionintintintHow many of the keywords listed happen to be required keyword args.Gets the restArgNode.booleanbooleanbooleanMethods inherited from class org.jruby.ast.Node
containsVariableAssignment, createList, createList, createList, createList, executesOnce, findFirstChild, getFile, getLine, getNodeName, isNewline, isNil, needsDefinitionCheck, setLine, setNewline, toString, toString, toStringExtraInfo, toStringInternal, unsetNewline
-
Field Details
-
args
-
optIndex
private final short optIndex -
postIndex
private final short postIndex -
keywordsIndex
private final short keywordsIndex -
restArgNode
-
keyRest
-
blockArgNode
-
NO_ARGS
-
-
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
-
getArgs
-
getOptArgIndex
public int getOptArgIndex() -
getPostIndex
public int getPostIndex() -
getKeywordsIndex
public int getKeywordsIndex() -
getNodeType
- Specified by:
getNodeTypein classNode- Returns:
- the nodeId
-
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:
childNodesin 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.
-