Amplication AST Libraries Documentation
    Preparing search index...

    Represents a Python function definition in the AST. This class handles the generation of Python function declarations including parameters, decorators, and return type annotations.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    name: string

    The name of the function

    parameters: Parameter[]

    The parameters of the function

    decorators: Decorator[]

    Decorators applied to the function

    docstring?: string

    The documentation string

    returnType?: ClassReference

    The return type annotation

    isStatic: boolean

    Whether this is a static method

    isClassMethod: boolean

    Whether this is a class method

    isAsync: boolean

    Whether this is an async function

    Methods

    • Adds a statement to the function body.

      Parameters

      Returns void

    • Writes the function definition and its body to the writer.

      Parameters

      • writer: Writer

        The writer to write to

      Returns void

    • Returns the string representation of the AST node. This method creates a new Writer instance and writes the node's content to it.

      Returns string

      The string representation of the AST node