Langium - v4.0.0
    Preparing search index...

    Function copyAstNode

    • Creates a deep copy of the specified AST node. The resulting copy will only contain semantically relevant information, such as the $type property and AST properties.

      Type Parameters

      Parameters

      • node: T

        The AST node to deeply copy.

      • buildReference: (
            node: AstNode,
            property: string,
            refNode: undefined | CstNode,
            refText: string,
            origReference: Reference<AstNode>,
        ) => Reference<AstNode>

        References are not copied, instead this function is called to rebuild them.

      • Optionaltrace: Map<AstNode, AstNode>

        For the sake of tracking copied nodes and their originals a trace map can be provided (optional).

      Returns T