Documentation
¶
Overview ¶
Package ir extracts control flow decisions from Go AST.
Package ir extracts control flow decisions from Go AST. It builds the intermediate representation consumed by the eval layer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDecisions ¶
BuildDecisions extracts all control flow decisions from a function body. Each decision has outcomes with statement counts (DirectStatements from the immediate block, ReachableEstimate from the full subtree).
Params:
- fset: token file set for position info
- body: function body to analyze
Returns:
- decisions: extracted decisions
func ExtractCondition ¶
ExtractCondition returns a human-readable textual representation of an AST expression. Used for decision labels and diagnostic messages.
Params:
- expr: AST expression
Returns:
- text: textual representation
Types ¶
type ParamConstraint ¶
type ParamConstraint struct {
// Name is the parameter or variable name.
Name string
// Type is the Go type (nil if unavailable).
Type types.Type
// Operator is the comparison operator (">", "==", "!=", "len", etc.).
Operator string
// Value is the textual comparison value ("0", "nil", `""`).
Value string
}
ParamConstraint describes a constraint on a function parameter derived from a branch condition.
func ExtractParams ¶
func ExtractParams(expr ast.Expr, info *types.Info) (constraints []ParamConstraint)
ExtractParams identifies parameter constraints from a condition expression. Only extracts simple binary comparisons (x > 0, err != nil, ok == true).
Params:
- expr: condition expression
- info: type information (can be nil for untyped analysis)
Returns:
- constraints: extracted constraints