From 49403cbfa0399bb4284ea5c36cc90216a0bda6ff Mon Sep 17 00:00:00 2001 From: Nathan Franke Date: Thu, 9 Dec 2021 03:42:46 -0600 Subject: Replace String comparisons with "", String() to is_empty() Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings --- modules/gdscript/editor/gdscript_highlighter.cpp | 6 +++--- modules/gdscript/gdscript.cpp | 22 +++++++++++----------- modules/gdscript/gdscript_cache.cpp | 6 +++--- modules/gdscript/gdscript_compiler.cpp | 8 ++++---- modules/gdscript/gdscript_editor.cpp | 4 ++-- modules/gdscript/gdscript_parser.cpp | 4 ++-- modules/gdscript/gdscript_vm.cpp | 20 ++++++++++---------- modules/gdscript/tests/gdscript_test_runner.cpp | 2 +- 8 files changed, 36 insertions(+), 36 deletions(-) (limited to 'modules/gdscript') diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp index 6529154e5c..4f711dfd1e 100644 --- a/modules/gdscript/editor/gdscript_highlighter.cpp +++ b/modules/gdscript/editor/gdscript_highlighter.cpp @@ -413,7 +413,7 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l previous_column = j; // ignore if just whitespace - if (text != "") { + if (!text.is_empty()) { previous_text = text; } } @@ -509,7 +509,7 @@ void GDScriptSyntaxHighlighter::_update_cache() { for (const String &comment : comments) { String beg = comment.get_slice(" ", 0); String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String(); - add_color_region(beg, end, comment_color, end == ""); + add_color_region(beg, end, comment_color, end.is_empty()); } /* Strings */ @@ -519,7 +519,7 @@ void GDScriptSyntaxHighlighter::_update_cache() { for (const String &string : strings) { String beg = string.get_slice(" ", 0); String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String(); - add_color_region(beg, end, string_color, end == ""); + add_color_region(beg, end, string_color, end.is_empty()); } const Ref