diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:41:43 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 21:57:34 +0200 |
commit | 0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 (patch) | |
tree | 198d4ff7665d89307f6ca2469fa38620a9eb1672 /modules/gdnative/pluginscript | |
parent | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (diff) |
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
Diffstat (limited to 'modules/gdnative/pluginscript')
-rw-r--r-- | modules/gdnative/pluginscript/pluginscript_loader.cpp | 9 | ||||
-rw-r--r-- | modules/gdnative/pluginscript/pluginscript_script.cpp | 33 |
2 files changed, 27 insertions, 15 deletions
diff --git a/modules/gdnative/pluginscript/pluginscript_loader.cpp b/modules/gdnative/pluginscript/pluginscript_loader.cpp index 7ce124c16a..4feee4f4a5 100644 --- a/modules/gdnative/pluginscript/pluginscript_loader.cpp +++ b/modules/gdnative/pluginscript/pluginscript_loader.cpp @@ -40,8 +40,9 @@ ResourceFormatLoaderPluginScript::ResourceFormatLoaderPluginScript(PluginScriptL } RES ResourceFormatLoaderPluginScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) { - if (r_error) + if (r_error) { *r_error = ERR_FILE_CANT_OPEN; + } PluginScript *script = memnew(PluginScript); script->init(_language); @@ -55,8 +56,9 @@ RES ResourceFormatLoaderPluginScript::load(const String &p_path, const String &p script->reload(); - if (r_error) + if (r_error) { *r_error = OK; + } return scriptres; } @@ -71,8 +73,9 @@ bool ResourceFormatLoaderPluginScript::handles_type(const String &p_type) const String ResourceFormatLoaderPluginScript::get_resource_type(const String &p_path) const { String el = p_path.get_extension().to_lower(); - if (el == _language->get_extension()) + if (el == _language->get_extension()) { return _language->get_type(); + } return ""; } diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp index d659ade876..87c6288806 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.cpp +++ b/modules/gdnative/pluginscript/pluginscript_script.cpp @@ -154,10 +154,12 @@ Ref<Script> PluginScript::get_base_script() const { } StringName PluginScript::get_instance_base_type() const { - if (_native_parent) + if (_native_parent) { return _native_parent; - if (_ref_base_parent.is_valid()) + } + if (_ref_base_parent.is_valid()) { return _ref_base_parent->get_instance_base_type(); + } return StringName(); } @@ -226,8 +228,9 @@ String PluginScript::get_source_code() const { } void PluginScript::set_source_code(const String &p_code) { - if (_source == p_code) + if (_source == p_code) { return; + } _source = p_code; } @@ -241,11 +244,13 @@ Error PluginScript::reload(bool p_keep_state) { _valid = false; String basedir = _path; - if (basedir == "") + if (basedir == "") { basedir = get_path(); + } - if (basedir != "") + if (basedir != "") { basedir = basedir.get_base_dir(); + } if (_data) { _desc->finish(_data); @@ -471,11 +476,11 @@ void PluginScript::get_script_signal_list(List<MethodInfo> *r_signals) const { int PluginScript::get_member_line(const StringName &p_member) const { #ifdef TOOLS_ENABLED - if (_member_lines.has(p_member)) + if (_member_lines.has(p_member)) { return _member_lines[p_member]; - else + } #endif - return -1; + return -1; } Vector<ScriptNetData> PluginScript::get_rpc_methods() const { @@ -494,15 +499,17 @@ uint16_t PluginScript::get_rpc_method_id(const StringName &p_method) const { StringName PluginScript::get_rpc_method(const uint16_t p_rpc_method_id) const { ASSERT_SCRIPT_VALID_V(StringName()); - if (p_rpc_method_id >= _rpc_methods.size()) + if (p_rpc_method_id >= _rpc_methods.size()) { return StringName(); + } return _rpc_methods[p_rpc_method_id].name; } MultiplayerAPI::RPCMode PluginScript::get_rpc_mode_by_id(const uint16_t p_rpc_method_id) const { ASSERT_SCRIPT_VALID_V(MultiplayerAPI::RPC_MODE_DISABLED); - if (p_rpc_method_id >= _rpc_methods.size()) + if (p_rpc_method_id >= _rpc_methods.size()) { return MultiplayerAPI::RPC_MODE_DISABLED; + } return _rpc_methods[p_rpc_method_id].mode; } @@ -527,15 +534,17 @@ uint16_t PluginScript::get_rset_property_id(const StringName &p_property) const StringName PluginScript::get_rset_property(const uint16_t p_rset_property_id) const { ASSERT_SCRIPT_VALID_V(StringName()); - if (p_rset_property_id >= _rpc_variables.size()) + if (p_rset_property_id >= _rpc_variables.size()) { return StringName(); + } return _rpc_variables[p_rset_property_id].name; } MultiplayerAPI::RPCMode PluginScript::get_rset_mode_by_id(const uint16_t p_rset_property_id) const { ASSERT_SCRIPT_VALID_V(MultiplayerAPI::RPC_MODE_DISABLED); - if (p_rset_property_id >= _rpc_variables.size()) + if (p_rset_property_id >= _rpc_variables.size()) { return MultiplayerAPI::RPC_MODE_DISABLED; + } return _rpc_variables[p_rset_property_id].mode; } |