File tree 1 file changed +15
-0
lines changed
gopls/internal/analysis/yield
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,21 @@ func run(pass *analysis.Pass) (interface{}, error) {
93
93
// yield call to another yield call--possible the same one,
94
94
// following all block successors except "if yield() { ... }";
95
95
// in such cases we know that yield returned true.
96
+ //
97
+ // Note that this is a "may" dataflow analysis: it
98
+ // reports when a yield function _may_ be called again
99
+ // without a positive intervening check, but it is
100
+ // possible that the check is beyond the ability of
101
+ // the representation to detect, perhaps involving
102
+ // sophisticated use of booleans, indirect state (not
103
+ // in SSA registers), or multiple flow paths some of
104
+ // which are infeasible.
105
+ //
106
+ // A "must" analysis (which would report when a second
107
+ // yield call can only be reached after failing the
108
+ // boolean check) would be too conservative.
109
+ // In particular, the most common mistake is to
110
+ // forget to check the boolean at all.
96
111
for call , info := range ssaYieldCalls {
97
112
visited := make ([]bool , len (fn .Blocks )) // visited BasicBlock.Indexes
98
113
You can’t perform that action at this time.
0 commit comments