(e ast.NavigableExpr)
| 779 | } |
| 780 | |
| 781 | func hasComprehensionVar(e ast.NavigableExpr) bool { |
| 782 | idents := ast.MatchDescendants(e, ast.KindMatcher(ast.IdentKind)) |
| 783 | for _, identNode := range idents { |
| 784 | identName := identNode.AsIdent() |
| 785 | curr := identNode |
| 786 | parent, found := curr.Parent() |
| 787 | for found { |
| 788 | if parent.Kind() == ast.ComprehensionKind { |
| 789 | compre := parent.AsComprehension() |
| 790 | if (compre.AccuVar() == identName || compre.IterVar() == identName || compre.IterVar2() == identName) && |
| 791 | curr.ID() != compre.IterRange().ID() && curr.ID() != compre.AccuInit().ID() { |
| 792 | return true |
| 793 | } |
| 794 | } |
| 795 | curr = parent |
| 796 | parent, found = parent.Parent() |
| 797 | } |
| 798 | } |
| 799 | return false |
| 800 | } |
| 801 | |
| 802 | func isNestedComprehension(e ast.NavigableExpr) bool { |
| 803 | parent, found := e.Parent() |
no test coverage detected