Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NestingClassifier ¶
type NestingClassifier interface {
// IsNestingNode returns true if the given node introduces a new nesting level
// (e.g. if, for, while, with, try blocks).
IsNestingNode(node any) bool
// Children returns the child nodes of the given node.
Children(node any) []any
// Location returns the line number of the given node.
Location(node any) int
}
NestingClassifier abstracts the language-specific logic for determining which AST nodes introduce nesting levels. Language adapters implement this to classify their own node types.
type Result ¶
Result holds the nesting depth analysis result.
func ComputeMaxDepth ¶
func ComputeMaxDepth(root any, classifier NestingClassifier) *Result
ComputeMaxDepth computes the maximum nesting depth of the given AST tree. It uses the NestingClassifier to determine which nodes increase nesting depth.
Click to show internal directories.
Click to hide internal directories.