From 0a28b4cd94540e1b99ccd79a70bd37170e1cb614 Mon Sep 17 00:00:00 2001 From: George Marques Date: Mon, 23 May 2022 12:25:03 -0300 Subject: GDScript: Do not allow standalone lambdas They cannot be accessed in this case, so an error is shown to avoid misleading the uses, especially in case of named lambdas. --- modules/gdscript/tests/scripts/parser/errors/lambda_standalone.gd | 3 +++ modules/gdscript/tests/scripts/parser/errors/lambda_standalone.out | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 modules/gdscript/tests/scripts/parser/errors/lambda_standalone.gd create mode 100644 modules/gdscript/tests/scripts/parser/errors/lambda_standalone.out (limited to 'modules/gdscript/tests/scripts/parser') diff --git a/modules/gdscript/tests/scripts/parser/errors/lambda_standalone.gd b/modules/gdscript/tests/scripts/parser/errors/lambda_standalone.gd new file mode 100644 index 0000000000..fa0a43094e --- /dev/null +++ b/modules/gdscript/tests/scripts/parser/errors/lambda_standalone.gd @@ -0,0 +1,3 @@ +func test(): + func standalone(): + print("can't be accessed") diff --git a/modules/gdscript/tests/scripts/parser/errors/lambda_standalone.out b/modules/gdscript/tests/scripts/parser/errors/lambda_standalone.out new file mode 100644 index 0000000000..c6830c8258 --- /dev/null +++ b/modules/gdscript/tests/scripts/parser/errors/lambda_standalone.out @@ -0,0 +1,2 @@ +GDTEST_PARSER_ERROR +Standalone lambdas cannot be accessed. Consider assigning it to a variable. -- cgit v1.2.3