MCPcopy
hub / github.com/uber-go/nilaway / okRead

Struct okRead

assertion/function/assertiontree/rich_check_effect.go:157–162  ·  view source on GitHub ↗

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()`

Source from the content-addressed store, hash-verified

155// - channel ok receive: `v, ok := <-ch`
156// - function ok return: `r0, r1, r2, ..., ok := f()`
157type 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
164func (r *okRead) isTriggeredBy(expr ast.Expr) bool {
165 return exprMatchesTrackableExpr(r.root, expr, r.ok)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected