File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
gopls/internal/analysis/yield Expand file tree Collapse file tree 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) {
9393 // yield call to another yield call--possible the same one,
9494 // following all block successors except "if yield() { ... }";
9595 // 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.
96111 for call , info := range ssaYieldCalls {
97112 visited := make ([]bool , len (fn .Blocks )) // visited BasicBlock.Indexes
98113
You can’t perform that action at this time.
0 commit comments