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

Function parseExpr

assertion/function/assertiontree/rich_check_effect.go:271–283  ·  view source on GitHub ↗

parseExpr wraps a call to ParseExprAsProducer with two additional bits of useful handling: 1. check for the empty expression and return nil when passed it 2. if parsing fails with a panic, return nil (This can happen because handling for the sake of contracts is less refined than handling in the mor

(rootNode *RootAssertionNode, expr ast.Expr)

Source from the content-addressed store, hash-verified

269// here we don't check for library identifiers which cannot be found in the set of sources for this
270// analysis pass before we call ParseExprAsProducer below)
271func parseExpr(rootNode *RootAssertionNode, expr ast.Expr) TrackableExpr {
272 defer func() {
273 // This handles unexpected panics during parsing.
274 // TODO: consider removing this hack.
275 _ = recover()
276 }()
277 // this handles being passed the empty expression
278 if asthelper.IsEmptyExpr(expr) {
279 return nil
280 }
281 parsed, _ := rootNode.ParseExprAsProducer(expr, false)
282 return parsed
283}
284
285// NodeTriggersOkRead is a case of a node creating a rich bool effect for map reads, channel receives, and user-defined
286// functions in the "ok" form. Specifically, it matches on `AssignStmt`s of the form

Callers 5

NodeTriggersOkReadFunction · 0.85
NodeTriggersFuncErrRetFunction · 0.85
nodeAssignsAnyFunction · 0.85
exprMatchesTrackableExprFunction · 0.85

Calls 2

IsEmptyExprFunction · 0.92
ParseExprAsProducerMethod · 0.80

Tested by

no test coverage detected