Whether or not a 'node' is preceded by a label of the given string. Note: 'node' cannot be a SourceFile.
(node *ast.Node, labelName string)
| 565 | // Whether or not a 'node' is preceded by a label of the given string. |
| 566 | // Note: 'node' cannot be a SourceFile. |
| 567 | func isLabeledBy(node *ast.Node, labelName string) bool { |
| 568 | return ast.FindAncestorOrQuit(node.Parent, func(owner *ast.Node) ast.FindAncestorResult { |
| 569 | if !ast.IsLabeledStatement(owner) { |
| 570 | return ast.FindAncestorQuit |
| 571 | } |
| 572 | if owner.Label().Text() == labelName { |
| 573 | return ast.FindAncestorTrue |
| 574 | } |
| 575 | return ast.FindAncestorFalse |
| 576 | }) != nil |
| 577 | } |
| 578 | |
| 579 | func getBreakOrContinueStatementOccurrences(node *ast.Node, sourceFile *ast.SourceFile) []*ast.Node { |
| 580 | if owner := getBreakOrContinueOwner(node); owner != nil { |
no test coverage detected