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

Method truncatedProducerPos

annotation/full_trigger.go:66–77  ·  view source on GitHub ↗
(pass *analysishelper.EnhancedPass)

Source from the content-addressed store, hash-verified

64}
65
66func (t *FullTrigger) truncatedProducerPos(pass *analysishelper.EnhancedPass) token.Position {
67 // Our struct init analysis only tracks fields for depth 1 and relies on escape analysis for
68 // escaped fields (t.Producer.Expr here). Since there are functions that return nil producers
69 // (although they were never assigned to [FullTrigger.Producer]), NilAway concluded that
70 // [ProduceTrigger.Expr] must be nilable. Therefore, we add a redundant check here to guard
71 // against such cases and make NilAway happy.
72 // TODO: remove this redundant check .
73 if t.Producer.Expr == nil {
74 panic(fmt.Sprintf("nil Expr for producer %q", t.Producer))
75 }
76 return pass.PosToLocation(t.Producer.Expr.Pos())
77}
78
79// equals returns true if the two passed FullTriggers are equal, and false otherwise.
80func (t *FullTrigger) equals(other FullTrigger) bool {

Callers 1

PrestringsMethod · 0.95

Calls 2

PosToLocationMethod · 0.80
PosMethod · 0.45

Tested by

no test coverage detected