(self, fdef: FuncBase)
| 66 | |
| 67 | @contextmanager |
| 68 | def function_scope(self, fdef: FuncBase) -> Iterator[None]: |
| 69 | self.functions.append(fdef) |
| 70 | if not self.function: |
| 71 | self.function = fdef |
| 72 | else: |
| 73 | # Nested functions are part of the topmost function target. |
| 74 | self.ignored += 1 |
| 75 | yield |
| 76 | self.functions.pop() |
| 77 | if self.ignored: |
| 78 | # Leave a scope that's included in the enclosing target. |
| 79 | self.ignored -= 1 |
| 80 | else: |
| 81 | assert self.function |
| 82 | self.function = None |
| 83 | |
| 84 | def outer_functions(self) -> list[FuncBase]: |
| 85 | return self.functions[:-1] |
no test coverage detected