mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Merge pull request #94730 from dalexeev/gds-fix-while-locals-clearing
GDScript: Fix locals clearing after exiting `while` block
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
GDTEST_OK
|
||||
1
|
||||
1
|
||||
42
|
||||
|
||||
Reference in New Issue
Block a user