All Superinterfaces:
ICCompound, ICElement, ICStatement, Iterable<ICStatement>

@Ser public interface ICBlock extends ICCompound, Iterable<ICStatement>
C AST interface to represent a sequence of statements.

Example:

 {
     stm0;
     stm1;
     stm2;
 }
 

Statements cannot be null. An exception will be raised if an attempt to insert a null statement is made.

  • Method Details

    • generateHeader

      void generateHeader(COutputSink out)
    • generateBody

      void generateBody(COutputSink out, boolean methodBody)
      Raw body generation, the caller is responsible for calling generateEnter/generateExit
      Parameters:
      out -
    • generateFooter

      void generateFooter(COutputSink out)
    • clear

      void clear()
      Remove all statements of the block, making the block effectively empty: {}. Do not confuse this method with ICCompound.reset().
    • size

      int size()
    • isEmpty

      boolean isEmpty()
    • getAll

      List<ICStatement> getAll()
    • get

      ICStatement get(int index)
    • getLast

      ICStatement getLast()
    • set

      void set(int index, ICStatement stm)
    • insert

      void insert(int index, ICStatement stm)
    • insertAll

      void insertAll(int index, ICBlock srcblk)
      Insert all statements of a source block into this block. The source block is left untouched.
      Parameters:
      index - 0-based insertion index into this block
      srcblk - source block
    • add

      ICBlock add(ICStatement stm)
    • addAll

      ICBlock addAll(ICStatement... stms)
    • addAll

      ICBlock addAll(ICBlock b)
    • remove

      ICStatement remove(int index)
    • removeLast

      ICStatement removeLast()
    • remove

      boolean remove(ICStatement stm)
      Remove a statement from the block. Does not throw if the statement is not found.
      Parameters:
      stm - mandatory statement
      Returns:
      indicates success
    • duplicate

      ICBlock duplicate()
      Description copied from interface: ICElement
      Deep duplication of the element. Sub-elements are duplicated.

      Note: ICClass, ICMethod, ICField, ICIdentifier, ICConstant, ICType and ICLabel are not duplicated.

      Specified by:
      duplicate in interface ICCompound
      Specified by:
      duplicate in interface ICElement
      Specified by:
      duplicate in interface ICStatement