You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
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
This commit is contained in:
@@ -40,8 +40,9 @@ ResourceFormatLoaderPluginScript::ResourceFormatLoaderPluginScript(PluginScriptL
|
||||
}
|
||||
|
||||
RES ResourceFormatLoaderPluginScript::load(const String &p_path, const String &p_original_path, Error *r_error) {
|
||||
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 "";
|
||||
}
|
||||
|
||||
|
||||
@@ -145,10 +145,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();
|
||||
}
|
||||
|
||||
@@ -217,8 +219,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;
|
||||
}
|
||||
|
||||
@@ -232,11 +235,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);
|
||||
@@ -422,9 +427,6 @@ Error PluginScript::load_source_code(const String &p_path) {
|
||||
}
|
||||
|
||||
_source = s;
|
||||
#ifdef TOOLS_ENABLED
|
||||
// source_changed_cache=true;
|
||||
#endif
|
||||
_path = p_path;
|
||||
return OK;
|
||||
}
|
||||
@@ -443,11 +445,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;
|
||||
}
|
||||
|
||||
MultiplayerAPI::RPCMode PluginScript::get_rpc_mode(const StringName &p_method) const {
|
||||
|
||||
Reference in New Issue
Block a user