Merge pull request #94730 from dalexeev/gds-fix-while-locals-clearing
GDScript: Fix locals clearing after exiting `while` block
This commit is contained in:
commit
b2facc018a
3 changed files with 32 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue