transform

package
v0.0.0-...-d6b2721 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyTransformationToEveryApplicableStatement

func ApplyTransformationToEveryApplicableStatement[T ast.Node](input []byte, buildTransformation func(node T, parentSelector string) Transformation) []*ast.File

ApplyTransformationToEveryApplicableStatement modifies a statement in-place

Casts a node to the given type and only calls transformOrNil if the type of node is equal to the type parameter T

Types

type DeleteTransformation

type DeleteTransformation struct {
}

func NewDeleteTransformation

func NewDeleteTransformation() *DeleteTransformation

func (*DeleteTransformation) ProcessNode

func (t *DeleteTransformation) ProcessNode(cursor astutil.Cursor) bool

type NoopTransformation

type NoopTransformation struct {
}

func NewNoopTransformation

func NewNoopTransformation() *NoopTransformation

func (*NoopTransformation) ProcessNode

func (t *NoopTransformation) ProcessNode(_ astutil.Cursor) bool

type ReplacementTransformation

type ReplacementTransformation struct {
	ReplacementNode ast.Node
}

func NewReplacementTransformation

func NewReplacementTransformation(replacementNode ast.Node) *ReplacementTransformation

func (*ReplacementTransformation) ProcessNode

func (t *ReplacementTransformation) ProcessNode(cursor astutil.Cursor) bool

type ScopeLayer

type ScopeLayer struct {
	Name       string
	Start, End token.Pos
}

type ScopeStack

type ScopeStack struct {
	collection.Stack[ScopeLayer]
}

func (ScopeStack) ScopeOfCurrentPosition

func (s ScopeStack) ScopeOfCurrentPosition(cursor astutil.Cursor) string

func (ScopeStack) String

func (s ScopeStack) String() string

type Transformation

type Transformation interface {
	ProcessNode(cursor astutil.Cursor) bool
}

Jump to

Keyboard shortcuts

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