Merge pull request #73798 from vonagam/fix-bad-continue-in-lambda

GDScript: Fix parsing unexpected break/continue in lambda
This commit is contained in:
Rémi Verschelde
2023-02-23 13:54:56 +01:00
5 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
func test():
for index in range(0, 1):
var lambda := func():
continue
print('not ok')

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Cannot use "continue" outside of a loop.

View File

@@ -0,0 +1,13 @@
func test():
var i_string := ''
for i in 3:
if i == 1: continue
var lambda := func():
var j_string := ''
for j in 3:
if j == 1: continue
j_string += str(j)
return j_string
i_string += lambda.call()
assert(i_string == '0202')
print('ok')

View File

@@ -0,0 +1,2 @@
GDTEST_OK
ok