Merge pull request #94730 from dalexeev/gds-fix-while-locals-clearing

GDScript: Fix locals clearing after exiting `while` block
This commit is contained in:
Rémi Verschelde
2024-07-26 13:44:09 +02:00
3 changed files with 32 additions and 7 deletions

View File

@@ -1,6 +1,5 @@
# GH-77666
func test():
func test_exit_if():
var ref := RefCounted.new()
print(ref.get_reference_count())
@@ -8,3 +7,20 @@ func test():
var _temp := ref
print(ref.get_reference_count())
# GH-94654
func test_exit_while():
var slots_data := []
while true:
@warning_ignore("confusable_local_declaration")
var slot = 42
slots_data.append(slot)
break
var slot: int = slots_data[0]
print(slot)
func test():
test_exit_if()
test_exit_while()