(e ast.NavigableExpr)
| 712 | } |
| 713 | |
| 714 | func hasComprehensionVar(e ast.NavigableExpr) bool { |
| 715 | idents := ast.MatchDescendants(e, ast.KindMatcher(ast.IdentKind)) |
| 716 | for _, identNode := range idents { |
| 717 | identName := identNode.AsIdent() |
| 718 | curr := identNode |
| 719 | parent, found := curr.Parent() |
| 720 | for found { |
| 721 | if parent.Kind() == ast.ComprehensionKind { |
| 722 | compre := parent.AsComprehension() |
| 723 | if (compre.AccuVar() == identName || compre.IterVar() == identName || compre.IterVar2() == identName) && |
| 724 | curr.ID() != compre.IterRange().ID() && curr.ID() != compre.AccuInit().ID() { |
| 725 | return true |
| 726 | } |
| 727 | } |
| 728 | curr = parent |
| 729 | parent, found = parent.Parent() |
| 730 | } |
| 731 | } |
| 732 | return false |
| 733 | } |
| 734 | |
| 735 | func isNestedComprehension(e ast.NavigableExpr) bool { |
| 736 | parent, found := e.Parent() |
no test coverage detected