Package org.jruby.ast
Class ConstDeclNode
java.lang.Object
org.jruby.ast.Node
org.jruby.ast.AssignableNode
org.jruby.ast.ConstDeclNode
- All Implemented Interfaces:
INameNode
Declaration (and assignment) of a Constant.
-
Field Summary
Fields inherited from class org.jruby.ast.Node
containsVariableAssignment, newline
-
Constructor Summary
ConstructorsConstructorDescriptionConstDeclNode
(int line, RubySymbol name, INameNode constNode, Node valueNode) -
Method Summary
Modifier and TypeMethodDescription<T> T
accept
(NodeVisitor<T> iVisitor) Accept for the visitor pattern.Get the full path, including the name of the new constant (in Foo::BAR it is Foo::BAR) or null.getName()
Gets the name (this is the rightmost element of lhs (in Foo::BAR it is BAR).boolean
Check whether the given node is considered always "defined" or whether it has some form of definition check.Methods inherited from class org.jruby.ast.AssignableNode
getValueNode, setValueNode
Methods inherited from class org.jruby.ast.Node
containsVariableAssignment, createList, createList, createList, createList, executesOnce, getFile, getLine, getNodeName, isNewline, isNil, setLine, setNewline, toString, toString, toStringExtraInfo, toStringInternal, unsetNewline
-
Constructor Details
-
ConstDeclNode
-
-
Method Details
-
getNodeType
- Specified by:
getNodeType
in classNode
- Returns:
- the nodeId
-
accept
Accept for the visitor pattern. -
getName
Gets the name (this is the rightmost element of lhs (in Foo::BAR it is BAR). name is the constant Name, it normally starts with a Capital -
getConstNode
Get the full path, including the name of the new constant (in Foo::BAR it is Foo::BAR) or null. Your probably want to extract the left part with((Colon2Node) node.getConstNode()).getLeftNode()
ifnode.getConstNode()
is aColon2ConstNode
.- Returns:
- pathNode
-
childNodes
- Specified by:
childNodes
in classNode
-
needsDefinitionCheck
public boolean needsDefinitionCheck()Description copied from class:Node
Check whether the given node is considered always "defined" or whether it has some form of definition check.- Overrides:
needsDefinitionCheck
in classNode
- Returns:
- Whether the type of node represents a possibly undefined construct
-