cycles

package
v2.948.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cycle

type Cycle map[*ast.TypeDef]bool

Cycle represents a strongly connected component (SCC) as a set of TypeDef pointers

func (Cycle) ToMermaid

func (c Cycle) ToMermaid() string

ToMermaid makes it easy to visualize the cycle, only used for debugging

type CycleDetector

type CycleDetector struct {
	// Cycles found in the AST
	Cycles []Cycle
	// contains filtered or unexported fields
}

func New

func New() *CycleDetector

CycleDetector detects cycles otherwise known as strongly connected components (SCCs) using Tarjan's algorithm Cycles differ from SCCs in one subtle way: a single node is considered an SCC even if it's not self-referential we discard these trivial SCCs are they are not cycles.

func (*CycleDetector) AreCircular

func (c *CycleDetector) AreCircular(t1 *ast.TypeDef, t2 *ast.TypeDef) bool

AreCircular checks if two TypeDefs are part of the same cycle.

func (*CycleDetector) DetectCycles

func (c *CycleDetector) DetectCycles(t ast.TypeDefs) []Cycle

func (*CycleDetector) IsPartOfCycle

func (c *CycleDetector) IsPartOfCycle(t *ast.TypeDef) bool

IsPartOfCycle checks if a TypeDef is part of a cycle

func (*CycleDetector) Traverse

func (c *CycleDetector) Traverse(t *ast.TypeDef)

Jump to

Keyboard shortcuts

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