From 0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 16:41:43 +0200 Subject: Style: Enforce braces around if blocks and loops Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html --- modules/gdscript/editor/gdscript_highlighter.cpp | 3 +- modules/gdscript/gdscript.cpp | 163 ++++++++---- modules/gdscript/gdscript.h | 21 +- modules/gdscript/gdscript_compiler.cpp | 293 ++++++++++++++------- modules/gdscript/gdscript_compiler.h | 9 +- modules/gdscript/gdscript_editor.cpp | 51 ++-- modules/gdscript/gdscript_function.cpp | 55 ++-- modules/gdscript/gdscript_function.h | 3 +- modules/gdscript/gdscript_functions.cpp | 14 +- modules/gdscript/gdscript_parser.cpp | 273 ++++++++++++------- modules/gdscript/gdscript_parser.h | 6 +- modules/gdscript/gdscript_tokenizer.cpp | 51 ++-- .../language_server/gdscript_extend_parser.cpp | 12 +- .../language_server/gdscript_language_protocol.cpp | 10 +- .../language_server/gdscript_workspace.cpp | 9 +- modules/gdscript/language_server/lsp.hpp | 33 ++- modules/gdscript/register_types.cpp | 19 +- 17 files changed, 673 insertions(+), 352 deletions(-) (limited to 'modules/gdscript') diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp index c3091a56a6..d0f27b632b 100644 --- a/modules/gdscript/editor/gdscript_highlighter.cpp +++ b/modules/gdscript/editor/gdscript_highlighter.cpp @@ -178,8 +178,9 @@ Map GDScriptSyntaxHighlighter::_get_line_syntax_ if (in_region == -1 && !in_keyword && is_char && !prev_is_char) { int to = j; - while (to < str.length() && _is_text_char(str[to])) + while (to < str.length() && _is_text_char(str[to])) { to++; + } String word = str.substr(j, to - j); Color col = Color(); diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 1d26e2148e..632407c61f 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -180,10 +180,12 @@ Ref