(tp *typeparser.TypeParser, sf *ast.SourceFile)
| 42 | } |
| 43 | |
| 44 | func AnalyzeNestedEffectGenYield(tp *typeparser.TypeParser, sf *ast.SourceFile) []NestedEffectGenYieldMatch { |
| 45 | var matches []NestedEffectGenYieldMatch |
| 46 | |
| 47 | var walk ast.Visitor |
| 48 | walk = func(node *ast.Node) bool { |
| 49 | if node == nil { |
| 50 | return false |
| 51 | } |
| 52 | |
| 53 | if node.Kind == ast.KindYieldExpression { |
| 54 | yieldExpr := node.AsYieldExpression() |
| 55 | if yieldExpr != nil && yieldExpr.AsteriskToken != nil && yieldExpr.Expression != nil { |
| 56 | if tp.GetEffectContextFlags(node)&typeparser.EffectContextFlagCanYieldEffect != 0 { |
| 57 | if tp.EffectGenCall(yieldExpr.Expression) != nil { |
| 58 | matches = append(matches, NestedEffectGenYieldMatch{ |
| 59 | Location: scanner.GetErrorRangeForNode(sf, yieldExpr.Expression), |
| 60 | }) |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | node.ForEachChild(walk) |
| 67 | return false |
| 68 | } |
| 69 | |
| 70 | walk(sf.AsNode()) |
| 71 | return matches |
| 72 | } |
no test coverage detected