(e ast.NavigableExpr)
| 687 | } |
| 688 | |
| 689 | func hasComprehensionVar(e ast.NavigableExpr) bool { |
| 690 | idents := ast.MatchDescendants(e, ast.KindMatcher(ast.IdentKind)) |
| 691 | for _, identNode := range idents { |
| 692 | identName := identNode.AsIdent() |
| 693 | curr := identNode |
| 694 | parent, found := curr.Parent() |
| 695 | for found { |
| 696 | if parent.Kind() == ast.ComprehensionKind { |
| 697 | compre := parent.AsComprehension() |
| 698 | if (compre.AccuVar() == identName || compre.IterVar() == identName || compre.IterVar2() == identName) && |
| 699 | curr.ID() != compre.IterRange().ID() && curr.ID() != compre.AccuInit().ID() { |
| 700 | return true |
| 701 | } |
| 702 | } |
| 703 | curr = parent |
| 704 | parent, found = parent.Parent() |
| 705 | } |
| 706 | } |
| 707 | return false |
| 708 | } |
| 709 | |
| 710 | func isNestedComprehension(e ast.NavigableExpr) bool { |
| 711 | parent, found := e.Parent() |
no test coverage detected