modules/gdscript/tests/scripts/runtime/features/reset_local_var_on_exit_block.gd
raw| 1 | # GH-77666 |
| 2 | func test_exit_if(): |
| 3 | var ref := RefCounted.new() |
| 4 | print(ref.get_reference_count()) |
| 5 | |
| 6 | if true: |
| 7 | var _temp := ref |
| 8 | |
| 9 | print(ref.get_reference_count()) |
| 10 | |
| 11 | # GH-94654 |
| 12 | func test_exit_while(): |
| 13 | var slots_data := [] |
| 14 | |
| 15 | while true: |
| 16 | @warning_ignore("confusable_local_declaration") |
| 17 | var slot = 42 |
| 18 | slots_data.append(slot) |
| 19 | break |
| 20 | |
| 21 | var slot: int = slots_data[0] |
| 22 | print(slot) |
| 23 | |
| 24 | func test(): |
| 25 | test_exit_if() |
| 26 | test_exit_while() |