Interface MutationOperator

Represents a operator that defines how to find and modify a specific part of the code to introduce a mutation.

interface MutationOperator {
    id: string;
    queryText: string;
    findMutationTargetNodes(match: QueryMatch): SyntaxNode[];
    getCodeMutation(
        match: QueryMatch,
        options?: MutationGenerationOptions,
    ): null | CodeMutation;
}

Properties

id: string

A unique identifier for this operator.

queryText: string

The query text, in tree-sitter query syntax, used to find the code snippets that can be mutated.

Methods

  • Get the nodes that can potentially be mutated, based on the matches of the query.

    Not every query match will be mutable, since the query may be optimized for performance and return more nodes than needed, or the mutation may not be applicable to all matches.

    Parameters

    • match: QueryMatch

    Returns SyntaxNode[]