Top Description Fields Constructors Methods
org.jruby.ast

public Class ConstDeclNode

extends AssignableNode
implements INameNode
Class Inheritance
All Implemented Interfaces
org.jruby.ast.types.INameNode
Imports
java.util.List, org.jruby.RubySymbol, org.jruby.ast.types.INameNode, org.jruby.ast.visitor.NodeVisitor

Declaration (and assignment) of a Constant.

Field Summary

Modifier and TypeField and Description
private final INameNode
private final RubySymbol

Constructor Summary

AccessConstructor and Description
public
ConstDeclNode(int line, RubySymbol name, INameNode constNode, Node valueNode)

Method Summary

Modifier and TypeMethod and Description
public <T> T
accept(NodeVisitor<T>
the visitor
iVisitor
)

Implements abstract org.jruby.ast.Node.accept.

Accept for the visitor pattern.

public List<Node>
public Node

Returns:

pathNode
getConstNode
()

Get the full path, including the name of the new constant (in Foo::BAR it is Foo::BAR) or null.

public RubySymbol

Returns:

name
getName
()

Implements org.jruby.ast.types.INameNode.getName.

Gets the name (this is the rightmost element of lhs (in Foo::BAR it is BAR).

public NodeType
public boolean
needsDefinitionCheck()

Overrides org.jruby.ast.Node.needsDefinitionCheck.

Check whether the given node is considered always "defined" or whether it has some form of definition check.

Inherited from org.jruby.ast.AssignableNode:
getValueNodesetValueNode

Field Detail

constNodeback to summary
private final INameNode constNode
nameback to summary
private final RubySymbol name

Constructor Detail

ConstDeclNodeback to summary
public ConstDeclNode(int line, RubySymbol name, INameNode constNode, Node valueNode)

Method Detail

acceptback to summary
public <T> T accept(NodeVisitor<T> iVisitor)

Implements abstract org.jruby.ast.Node.accept.

Accept for the visitor pattern.

Parameters
iVisitor:NodeVisitor<T>

the visitor

childNodesback to summary
public List<Node> childNodes()

Implements abstract org.jruby.ast.Node.childNodes.

getConstNodeback to summary
public Node 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() if node.getConstNode() is a Colon2ConstNode.

Returns:Node

pathNode

getNameback to summary
public RubySymbol getName()

Implements org.jruby.ast.types.INameNode.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

Returns:RubySymbol

name

getNodeTypeback to summary
public NodeType getNodeType()

Implements abstract org.jruby.ast.Node.getNodeType.

Returns:NodeType

Doc from org.jruby.ast.Node.getNodeType.

the nodeId

needsDefinitionCheckback to summary
public boolean needsDefinitionCheck()

Overrides org.jruby.ast.Node.needsDefinitionCheck.

Doc from org.jruby.ast.Node.needsDefinitionCheck.

Check whether the given node is considered always "defined" or whether it has some form of definition check.

Returns:boolean

Whether the type of node represents a possibly undefined construct

Annotations
@Override