Returns the call context of a computation which is called from contexts 'a' and 'b'.
| 177 | // Returns the call context of a computation which is called from contexts 'a' |
| 178 | // and 'b'. |
| 179 | CallContext UnionContexts(CallContext a, CallContext b) { |
| 180 | if (a == CallContext::kNone) { |
| 181 | return b; |
| 182 | } else if (b == CallContext::kNone) { |
| 183 | return a; |
| 184 | } else if (a == b) { |
| 185 | return a; |
| 186 | } else { |
| 187 | // Contexts are different and neither is kNone, ie one is kSequential and |
| 188 | // the other is kParallel. |
| 189 | return CallContext::kBoth; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | } // namespace |
| 194 |