diff options
| author | Rémi Verschelde <remi@verschelde.fr> | 2023-06-21 13:52:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-21 13:52:42 +0200 |
| commit | a2ce7a8f8817f516995c0e88cae4519a50ab9639 (patch) | |
| tree | 7dfb1c08d37963f2fe50f97325b2e605bb95e834 /modules/gdscript/tests/scripts/parser | |
| parent | ee41b2097c7881bcd63bb7d5d5690fad8a9ade1d (diff) | |
| parent | bf04c5517534848970de1652866b13afac50eba9 (diff) | |
| download | redot-engine-a2ce7a8f8817f516995c0e88cae4519a50ab9639.tar.gz | |
Merge pull request #78494 from kinami-imai/SSDinaTvuI8geW91IGFsbAo=
Fix lambda parsing continuing on subsequent lines
Diffstat (limited to 'modules/gdscript/tests/scripts/parser')
4 files changed, 92 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/parser/errors/lambda_no_continue_on_new_line.gd b/modules/gdscript/tests/scripts/parser/errors/lambda_no_continue_on_new_line.gd new file mode 100644 index 0000000000..8c5fb46109 --- /dev/null +++ b/modules/gdscript/tests/scripts/parser/errors/lambda_no_continue_on_new_line.gd @@ -0,0 +1,6 @@ +# https://github.com/godotengine/godot/issues/73273 + +func not_called(): + var v + v=func(): v=1 + in v diff --git a/modules/gdscript/tests/scripts/parser/errors/lambda_no_continue_on_new_line.out b/modules/gdscript/tests/scripts/parser/errors/lambda_no_continue_on_new_line.out new file mode 100644 index 0000000000..539240f790 --- /dev/null +++ b/modules/gdscript/tests/scripts/parser/errors/lambda_no_continue_on_new_line.out @@ -0,0 +1,2 @@ +GDTEST_PARSER_ERROR +Expected statement, found "in" instead. diff --git a/modules/gdscript/tests/scripts/parser/features/lambda_ends_with_new_line.gd b/modules/gdscript/tests/scripts/parser/features/lambda_ends_with_new_line.gd new file mode 100644 index 0000000000..df6001c7e2 --- /dev/null +++ b/modules/gdscript/tests/scripts/parser/features/lambda_ends_with_new_line.gd @@ -0,0 +1,59 @@ +# https://github.com/godotengine/godot/issues/73273 + +func other(callable : Callable): + callable.call() + +func four_parameters(_a, callable : Callable, b=func(): print(10)): + callable.call() + b.call() + +func test(): + var v + v=func():v=1 + if true: v=1 + print(v) + print() + + v=func(): print(2) if false else print(3) + @warning_ignore("unsafe_cast") + (v as Callable).call() + print() + + v=func(): + print(4) + print(5) + @warning_ignore("unsafe_cast") + if true: (v as Callable).call() + print() + + other(v) + print() + + other(func(): print(6)) + print() + + other(func(): + print(7) + print(8) + ) + print() + + four_parameters(1,func():print(9)) + four_parameters(1,func():print(9), func(): print(11)) + four_parameters(1,func(): + print(12) + print(13) + , func(): print(11)) + print() + + from_ticket() + +func from_ticket(): + var _v + if true: _v = (func(): test()) + if true: _v = (func(): test()) + if true: _v = (func(): test()) + + if true: _v = func(): test() + if true: _v = func(): test() + print(14) diff --git a/modules/gdscript/tests/scripts/parser/features/lambda_ends_with_new_line.out b/modules/gdscript/tests/scripts/parser/features/lambda_ends_with_new_line.out new file mode 100644 index 0000000000..4347310960 --- /dev/null +++ b/modules/gdscript/tests/scripts/parser/features/lambda_ends_with_new_line.out @@ -0,0 +1,25 @@ +GDTEST_OK +1 + +3 + +4 +5 + +4 +5 + +6 + +7 +8 + +9 +10 +9 +11 +12 +13 +11 + +14 |
