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

Function exprAsDeepProducer

assertion/function/assertiontree/backprop_util.go:801–811  ·  view source on GitHub ↗
(rootNode *RootAssertionNode, expr ast.Expr)

Source from the content-addressed store, hash-verified

799}
800
801func exprAsDeepProducer(rootNode *RootAssertionNode, expr ast.Expr) annotation.ProducingAnnotationTrigger {
802 _, parsedExpr := rootNode.ParseExprAsProducer(expr, true)
803 if len(parsedExpr) > 1 {
804 panic("multiply returning function passed where a deep producer is expected - tuple types are not deep")
805 }
806 if len(parsedExpr) == 0 || !parsedExpr[0].IsDeep() || parsedExpr[0].GetDeep() == nil {
807 // the expr is not deeply nilable
808 return &annotation.ProduceTriggerNever{}
809 }
810 return parsedExpr[0].GetDeep().Annotation
811}
812
813// CheckGuardOnFullTrigger gives guarding its intended semantics:
814// if a full trigger would be created with a guarded producer but

Callers 4

AddComputationMethod · 0.85
addReturnConsumersFunction · 0.85
backpropAcrossAssignmentFunction · 0.85
backpropAcrossRangeFunction · 0.85

Calls 3

ParseExprAsProducerMethod · 0.80
IsDeepMethod · 0.65
GetDeepMethod · 0.65

Tested by

no test coverage detected