(self, code)
| 2531 | self.put(code) |
| 2532 | |
| 2533 | def put(self, code): |
| 2534 | fix_indent = False |
| 2535 | if "{" in code: |
| 2536 | dl = code.count("{") |
| 2537 | else: |
| 2538 | dl = 0 |
| 2539 | if "}" in code: |
| 2540 | dl -= code.count("}") |
| 2541 | if dl < 0: |
| 2542 | self.level += dl |
| 2543 | elif dl == 0 and code[0] == "}": |
| 2544 | # special cases like "} else {" need a temporary dedent |
| 2545 | fix_indent = True |
| 2546 | self.level -= 1 |
| 2547 | if self.bol: |
| 2548 | self.indent() |
| 2549 | self.write(code) |
| 2550 | self.bol = 0 |
| 2551 | if dl > 0: |
| 2552 | self.level += dl |
| 2553 | elif fix_indent: |
| 2554 | self.level += 1 |
| 2555 | |
| 2556 | def put_code_here(self, utility: UtilityCode): |
| 2557 | # Puts the impl section of the utility code directly to the current position. |
no test coverage detected