Package org.jruby.ast
Class ClassNode
java.lang.Object
org.jruby.ast.Node
org.jruby.ast.ClassNode
- All Implemented Interfaces:
IScopingNode
A class statement (name, superClass, body). Classes bodies also define their own scope.
-
Field Summary
Fields inherited from class org.jruby.ast.Node
containsVariableAssignment, newline
-
Constructor Summary
ConstructorsConstructorDescriptionClassNode
(int line, Colon3Node cpath, StaticScope scope, Node bodyNode, Node superNode, int endLine) -
Method Summary
Modifier and TypeMethodDescription<T> T
accept
(NodeVisitor<T> iVisitor) Accept for the visitor pattern.boolean
Gets the body of this class.getCPath()
Gets the className.int
Gets line where the 'end' was for this module.getScope()
Get the static scoping information.Gets the superNode.Methods inherited from class org.jruby.ast.Node
containsVariableAssignment, createList, createList, createList, createList, getFile, getLine, getNodeName, isNewline, isNil, needsDefinitionCheck, setLine, setNewline, toString, toString, toStringExtraInfo, toStringInternal, unsetNewline
-
Constructor Details
-
ClassNode
public ClassNode(int line, Colon3Node cpath, StaticScope scope, Node bodyNode, Node superNode, int endLine)
-
-
Method Details
-
getNodeType
- Specified by:
getNodeType
in classNode
- Returns:
- the nodeId
-
accept
Accept for the visitor pattern. -
getBodyNode
Gets the body of this class.- Specified by:
getBodyNode
in interfaceIScopingNode
- Returns:
- the contents
-
getEndLine
public int getEndLine()Gets line where the 'end' was for this module. -
getScope
Get the static scoping information.- Specified by:
getScope
in interfaceIScopingNode
- Returns:
- the scoping info
-
getCPath
Gets the className.- Specified by:
getCPath
in interfaceIScopingNode
- Returns:
- Returns representation of class path+name
-
getSuperNode
Gets the superNode.- Returns:
- Returns a Node
-
childNodes
- Specified by:
childNodes
in classNode
-
executesOnce
public boolean executesOnce()- Overrides:
executesOnce
in classNode
- Returns:
- is it possible this node will execute only once. Note: This is not comprehensive. It is used to look from root node down to class/module nodes to make sure that narrow case can execute once. It is possible much deeper down the tree some nodes can only execute once but it will be marked as false because that case is not what this is for.
-