Documentation
¶
Overview ¶
Package dstutil provides utilities for DST (Decorated Syntax Tree) manipulation.
Index ¶
- func InsertStatements(body *dst.BlockStmt, stmtStr string) bool
- func MatchesExact(a, b dst.Stmt) bool
- func MatchesSkeleton(a, b dst.Stmt) bool
- func ParseStatements(stmtStr string) ([]dst.Stmt, error)
- func RemoveStatements(body *dst.BlockStmt, index, count int) bool
- func UpdateStatements(body *dst.BlockStmt, index, count int, stmtStr string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsertStatements ¶
InsertStatements inserts statements at the beginning of a function body.
func MatchesExact ¶
MatchesExact compares two statements for exact equality. Unlike MatchesSkeleton, this also compares literal values.
func MatchesSkeleton ¶
MatchesSkeleton compares two statements by their AST structure. It returns true if both statements have the same "skeleton" - same node types and static identifiers, but potentially different dynamic values (variables, literals).
func ParseStatements ¶
ParseStatements parses a statement string into DST statements. Supports multiple statements separated by newlines.
func RemoveStatements ¶
RemoveStatements removes `count` statements starting at the given index.
Types ¶
This section is empty.