mutator

package
v0.0.0-...-3cc2fd5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package mutator provides mutation operators for the gorgon project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All() map[string]Operator

func ApplyOperator

func ApplyOperator(op Operator, node ast.Node, returnType string, file *ast.File, enclosingFunc *ast.FuncDecl) ast.Node

func ListCategories

func ListCategories() []string

func Register

func Register(op Operator)

Types

type Context

type Context struct {
	ReturnType    string
	FunctionName  string
	PackageName   string
	FileName      string
	Position      token.Position
	EnclosingFunc *ast.FuncDecl
	File          *ast.File
	Parent        ast.Node
}

type ContextualOperator

type ContextualOperator interface {
	Operator
	CanApplyWithContext(node ast.Node, ctx Context) bool
	MutateWithContext(node ast.Node, ctx Context) ast.Node
}

type Operator

type Operator interface {
	Name() string
	CanApply(node ast.Node) bool
	Mutate(node ast.Node) ast.Node
}

func Get

func Get(name string) (Operator, bool)

func GetCategory

func GetCategory(name string) ([]Operator, bool)

func List

func List() []Operator

func ListAll

func ListAll() []Operator

ListAll returns every registered operator regardless of selection. Used by sub-config resolution to map operator names to instances.

func MustGet

func MustGet(name string) Operator

type OperatorInitializer

type OperatorInitializer func() Operator

type OperatorRegistry

type OperatorRegistry struct {
	// contains filtered or unexported fields
}

func NewOperatorRegistry

func NewOperatorRegistry() *OperatorRegistry

func (*OperatorRegistry) All

func (r *OperatorRegistry) All() map[string]Operator

func (*OperatorRegistry) Get

func (r *OperatorRegistry) Get(name string) (Operator, bool)

func (*OperatorRegistry) List

func (r *OperatorRegistry) List() []Operator

func (*OperatorRegistry) Register

func (r *OperatorRegistry) Register(op Operator)

func (*OperatorRegistry) RegisterInitializer

func (r *OperatorRegistry) RegisterInitializer(name string, init OperatorInitializer)

type TypeAwareOperator

type TypeAwareOperator interface {
	RequiresTypeCheck() bool
}

Directories

Path Synopsis
utilities used by mutation operators.
utilities used by mutation operators.
operators
arithmetic_flip
Package arithmetic_flip provides arithmetic operator flip mutations.
Package arithmetic_flip provides arithmetic operator flip mutations.
assignment_operator
Package assignment_operator provides assignment operator mutation operators.
Package assignment_operator provides assignment operator mutation operators.
boundary_value
Package boundary_value provides boundary comparison mutation operators.
Package boundary_value provides boundary comparison mutation operators.
condition_negation
Package condition_negation provides condition negation mutations.
Package condition_negation provides condition negation mutations.
logical_operator
Package logical_operator provides logical operator replacement mutations.
Package logical_operator provides logical operator replacement mutations.
Package tokens defines operator flip maps used by token-based mutation operators.
Package tokens defines operator flip maps used by token-based mutation operators.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL