Package org.jruby.ast

Class ClassNode

java.lang.Object
org.jruby.ast.Node
org.jruby.ast.ClassNode
All Implemented Interfaces:
IScopingNode

public class ClassNode extends Node implements IScopingNode
A class statement (name, superClass, body). Classes bodies also define their own scope.
  • Constructor Details

  • Method Details

    • getNodeType

      public NodeType getNodeType()
      Specified by:
      getNodeType in class Node
      Returns:
      the nodeId
    • accept

      public <T> T accept(NodeVisitor<T> iVisitor)
      Accept for the visitor pattern.
      Specified by:
      accept in class Node
      Parameters:
      iVisitor - the visitor
    • getBodyNode

      public Node getBodyNode()
      Gets the body of this class.
      Specified by:
      getBodyNode in interface IScopingNode
      Returns:
      the contents
    • getEndLine

      public int getEndLine()
      Gets line where the 'end' was for this module.
    • getScope

      public StaticScope getScope()
      Get the static scoping information.
      Specified by:
      getScope in interface IScopingNode
      Returns:
      the scoping info
    • getCPath

      public Colon3Node getCPath()
      Gets the className.
      Specified by:
      getCPath in interface IScopingNode
      Returns:
      Returns representation of class path+name
    • getSuperNode

      public Node getSuperNode()
      Gets the superNode.
      Returns:
      Returns a Node
    • childNodes

      public List<Node> childNodes()
      Specified by:
      childNodes in class Node
    • executesOnce

      public boolean executesOnce()
      Overrides:
      executesOnce in class Node
      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.