okRead provides a general implementation for the special return form: `v1, v2, ..., ok := expr`. Concrete examples of patterns supported are: - map ok read: `v, ok := m[k]` - channel ok receive: `v, ok := <-ch` - function ok return: `r0, r1, r2, ..., ok := f()`
| 155 | // - channel ok receive: `v, ok := <-ch` |
| 156 | // - function ok return: `r0, r1, r2, ..., ok := f()` |
| 157 | type okRead struct { |
| 158 | root *RootAssertionNode // an associated root node |
| 159 | value TrackableExpr // `value` could be a value for read from a map or channel, or the return value of a function |
| 160 | ok TrackableExpr // `ok` is boolean "ok" for read from a map or channel, or return from a function |
| 161 | guard guard.Nonce // the guard to be applied on a matching check |
| 162 | } |
| 163 | |
| 164 | func (r *okRead) isTriggeredBy(expr ast.Expr) bool { |
| 165 | return exprMatchesTrackableExpr(r.root, expr, r.ok) |
nothing calls this directly
no outgoing calls
no test coverage detected