From 955d5affa857ec1f358c56da8fb1ff4ab6590704 Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:18:34 +0200 Subject: Reduce and prevent unnecessary random-access to `List` Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when accessing a single element) * Removed subscript operator, in favor of a more explicit `get` * Added conversion from `Iterator` to `ConstIterator` * Remade existing operations into other solutions when applicable --- modules/gdscript/tests/gdscript_test_runner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/gdscript/tests/gdscript_test_runner.cpp') diff --git a/modules/gdscript/tests/gdscript_test_runner.cpp b/modules/gdscript/tests/gdscript_test_runner.cpp index e3d16eaf42..a949c44d78 100644 --- a/modules/gdscript/tests/gdscript_test_runner.cpp +++ b/modules/gdscript/tests/gdscript_test_runner.cpp @@ -573,7 +573,7 @@ GDScriptTest::TestResult GDScriptTest::execute_test_code(bool p_is_generating) { const List &errors = parser.get_errors(); if (!errors.is_empty()) { // Only the first error since the following might be cascading. - result.output += errors[0].message + "\n"; // TODO: line, column? + result.output += errors.front()->get().message + "\n"; // TODO: line, column? } if (!p_is_generating) { result.passed = check_output(result.output); @@ -592,7 +592,7 @@ GDScriptTest::TestResult GDScriptTest::execute_test_code(bool p_is_generating) { const List &errors = parser.get_errors(); if (!errors.is_empty()) { // Only the first error since the following might be cascading. - result.output += errors[0].message + "\n"; // TODO: line, column? + result.output += errors.front()->get().message + "\n"; // TODO: line, column? } if (!p_is_generating) { result.passed = check_output(result.output); -- cgit v1.2.3