From 7ca038effa28c1767e43e4f66d2bd9f34852d5b7 Mon Sep 17 00:00:00 2001 From: George Marques Date: Thu, 25 Apr 2024 21:05:53 -0300 Subject: GDScript: Perform validated calls with static methods When the types are validated at compile time, this type of call runs faster. It is already used for instance methods, this adds this optimization to native static methods as well. --- .../runtime/features/call_native_static_method_validated.gd | 7 +++++++ .../runtime/features/call_native_static_method_validated.out | 2 ++ 2 files changed, 9 insertions(+) create mode 100644 modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.gd create mode 100644 modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.out (limited to 'modules/gdscript/tests/scripts') diff --git a/modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.gd b/modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.gd new file mode 100644 index 0000000000..35e4dbd6a0 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.gd @@ -0,0 +1,7 @@ +func test(): + # Validated native static call with return value. + print(FileAccess.file_exists("some_file")) + + # Validated native static call without return value. + Node.print_orphan_nodes() + diff --git a/modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.out b/modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.out new file mode 100644 index 0000000000..44302c8137 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.out @@ -0,0 +1,2 @@ +GDTEST_OK +false -- cgit v1.2.3