type CFG … type Block … type BlockKind … const KindInvalid … const KindUnreachable … const KindBody … const KindForBody … const KindForDone … const KindForLoop … const KindForPost … const KindIfDone … const KindIfElse … const KindIfThen … const KindLabel … const KindRangeBody … const KindRangeDone … const KindRangeLoop … const KindSelectCaseBody … const KindSelectDone … const KindSelectAfterCase … const KindSwitchCaseBody … const KindSwitchDone … const KindSwitchNextCase … func (kind BlockKind) String() string { … } // New returns a new control-flow graph for the specified function body, // which must be non-nil. // // The CFG builder calls mayReturn to determine whether a given function // call may return. For example, calls to panic, os.Exit, and log.Fatal // do not return, so the builder can remove infeasible graph edges // following such calls. The builder calls mayReturn only for a // CallExpr beneath an ExprStmt. func New(body *ast.BlockStmt, mayReturn func(*ast.CallExpr) bool) *CFG { … } func (b *Block) String() string { … } func (b *Block) comment(fset *token.FileSet) string { … } // Return returns the return statement at the end of this block if present, nil // otherwise. // // When control falls off the end of the function, the ReturnStmt is synthetic // and its [ast.Node.End] position may be beyond the end of the file. func (b *Block) Return() (ret *ast.ReturnStmt) { … } // Format formats the control-flow graph for ease of debugging. func (g *CFG) Format(fset *token.FileSet) string { … } // Dot returns the control-flow graph in the [Dot graph description language]. // Use a command such as 'dot -Tsvg' to render it in a form viewable in a browser. // This method is provided as a debugging aid; the details of the // output are unspecified and may change. // // [Dot graph description language]: https://en.wikipedia.org/wiki/DOT_(graph_description_language) func (g *CFG) Dot(fset *token.FileSet) string { … } func formatNode(fset *token.FileSet, n ast.Node) string { … }