All Superinterfaces:
ICDecompilableElement, ICElement, ICSourceElement, IOptimizerTarget

@Ser public interface ICMethod extends ICDecompilableElement, IOptimizerTarget
C AST method objects are top-level AST objects that can be retrieved by a ICMethodFactory.
  • Method Details

    • getIdentifierManager

      ICIdentifierManager getIdentifierManager()
      Retrieve this method's identifier manager (local variable factory).
      Returns:
    • getLabelFactory

      ICLabelFactory getLabelFactory()
      Retrieve this method's label factory.
      Returns:
    • getParameters

      List<ICDecl> getParameters()
      Returns:
    • addParameter

      void addParameter(ICDecl param)
    • addParameter

      void addParameter(int index, ICDecl param)
    • removeParameter

      void removeParameter(int index)
    • getReturnTypes

      List<ICType> getReturnTypes()
    • getReturnType

      ICType getReturnType()
      Retrieve the primary return type, or the void type if this method does not return anything. The primary return type, if not void, is the first element returned by getReturnTypes().
      Returns:
      never null
    • getClassType

      ICType getClassType()
    • getName

      String getName()
    • getBody

      ICBlock getBody()
    • isEmpty

      boolean isEmpty()
    • generateName

      void generateName(COutputSink out, boolean definition)
    • getStatements

      List<ICStatement> getStatements()
      Walk the tree and get the ordered list of all (non-pseudo) statements that make up the method.
      Returns:
    • addStatement

      void addStatement(ICStatement stm)
    • getLastStatement

      ICStatement getLastStatement()
    • deleteStatement

      boolean deleteStatement(ICStatement stm)
      Delete a statement by reference.
      Parameters:
      stm - the statement to delete
      Returns:
      true if the statement was found and deleted
    • insertAtOffset

      boolean insertAtOffset(long offset, ICStatement stm)
    • visitStatements

      boolean visitStatements(ICVisitor visitor)
      Visit all statements of the method's body recursively. This method differs from getStatements(), which simply returns the list of statements contained in the body, but not the statements contained in the statements.
      Parameters:
      visitor - a visitor object
      Returns:
      the success code
    • toFlatList

      List<ICStatement> toFlatList()
      Flatten the abstract syntax tree. The returned list contains extra statements, called "pseudo-statements", needed to represent the structure of the method.
      In programmer's words, all statements implementing ICoumpound in the AST are replaced by two or more appropriate objects deriving from PseudoStatement.
      Returns:
      the list of all statements (including pseudo-statements) that make up the method
    • fromFlatList

      void fromFlatList(List<ICStatement> list)
      Regenerate the AST of this method based on a flat list of statements and pseudo-statements.
      Parameters:
      list - the list of all statements (including pseudo-statements) that make up the method
    • duplicate

      ICMethod 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 ICDecompilableElement
      Specified by:
      duplicate in interface ICElement
      Specified by:
      duplicate in interface ICSourceElement