Returns the first ancestor CondContext of `ctxt`. Returns `ctxt` if `ctxt` is a CondContext, or None if `ctxt` is not in a cond. Args: ctxt: ControlFlowContext Returns: `ctxt` if `ctxt` is a CondContext, the most nested CondContext containing `ctxt`, or None if `ctxt` is not in
(ctxt)
| 230 | |
| 231 | |
| 232 | def GetContainingCondContext(ctxt): |
| 233 | """Returns the first ancestor CondContext of `ctxt`. |
| 234 | |
| 235 | Returns `ctxt` if `ctxt` is a CondContext, or None if `ctxt` is not in a cond. |
| 236 | |
| 237 | Args: |
| 238 | ctxt: ControlFlowContext |
| 239 | |
| 240 | Returns: |
| 241 | `ctxt` if `ctxt` is a CondContext, the most nested CondContext containing |
| 242 | `ctxt`, or None if `ctxt` is not in a cond. |
| 243 | """ |
| 244 | while ctxt: |
| 245 | if ctxt.IsCondContext(): return ctxt |
| 246 | ctxt = ctxt.outer_context |
| 247 | return None |
| 248 | |
| 249 | |
| 250 | def IsContainingContext(ctxt, maybe_containing_ctxt): |
no test coverage detected