Interface SwitchNode

All Superinterfaces:
ASTNode, BlockItemNode, StatementNode

public interface SwitchNode extends StatementNode
Represents a C switch statement.
  • Method Details

    • getCondition

      ExpressionNode getCondition()
      Returns the branch condition controlling this switch statement.
      Returns:
      the condition
    • getBody

      StatementNode getBody()
      Returns the switch statement body: the switch statement has the form "switch(expression) body".
      Returns:
      switch statement body
    • getCases

      Returns the sequence of all case-labeled statements within this switch statement's body. This does not include the default case.

      Note: these are not children since they are reachable through the switch statement's body.

      Returns:
      sequence node listing all case-labeled statements in this switch statement
    • addCase

      void addCase(LabeledStatementNode statement)
      Adds a case clause to the list associated to this switch node.
      Parameters:
      statement - a case-labeled statement occurring in the body
    • getDefaultCase

      LabeledStatementNode getDefaultCase()
      Returns the "default"-labeled statement within this switch statement, or null if there isn't one.
      Returns:
      the default statement or null
    • setDefaultCase

      void setDefaultCase(LabeledStatementNode statement)
      Sets the default clause for this switch statement.
      Parameters:
      statement - the default-labeled statement in the switch node body
    • copy

      SwitchNode copy()
      Description copied from interface: ASTNode
      Returns a deep copy of this AST node. The node and all of its descendants will be cloned. The cloning does not copy analysis or attribute information.
      Specified by:
      copy in interface ASTNode
      Specified by:
      copy in interface BlockItemNode
      Specified by:
      copy in interface StatementNode
      Returns:
      deep copy of this node
    • clear

      void clear()
      Remove cases and default case.