mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +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:
parent
b8d198eeed
commit
140350d767
694 changed files with 23283 additions and 12499 deletions
|
@ -43,8 +43,9 @@ ScriptEditRequestFunction ScriptServer::edit_request_func = nullptr;
|
|||
|
||||
void Script::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_POSTINITIALIZE) {
|
||||
if (ScriptDebugger::get_singleton())
|
||||
if (ScriptDebugger::get_singleton()) {
|
||||
ScriptDebugger::get_singleton()->set_break_language(get_language());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,8 +158,9 @@ void ScriptServer::init_languages() {
|
|||
|
||||
for (int i = 0; i < script_classes.size(); i++) {
|
||||
Dictionary c = script_classes[i];
|
||||
if (!c.has("class") || !c.has("language") || !c.has("path") || !c.has("base"))
|
||||
if (!c.has("class") || !c.has("language") || !c.has("path") || !c.has("base")) {
|
||||
continue;
|
||||
}
|
||||
add_global_class(c["class"], c["base"], c["language"], c["path"]);
|
||||
}
|
||||
}
|
||||
|
@ -288,8 +290,9 @@ void ScriptInstance::get_property_state(List<Pair<StringName, Variant>> &state)
|
|||
if (E->get().usage & PROPERTY_USAGE_STORAGE) {
|
||||
Pair<StringName, Variant> p;
|
||||
p.first = E->get().name;
|
||||
if (get(p.first, p.second))
|
||||
if (get(p.first, p.second)) {
|
||||
state.push_back(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -298,8 +301,9 @@ Variant ScriptInstance::call(const StringName &p_method, VARIANT_ARG_DECLARE) {
|
|||
VARIANT_ARGPTRS;
|
||||
int argc = 0;
|
||||
for (int i = 0; i < VARIANT_ARG_MAX; i++) {
|
||||
if (argptr[i]->get_type() == Variant::NIL)
|
||||
if (argptr[i]->get_type() == Variant::NIL) {
|
||||
break;
|
||||
}
|
||||
argc++;
|
||||
}
|
||||
|
||||
|
@ -318,13 +322,15 @@ void ScriptInstance::call_multilevel_reversed(const StringName &p_method, const
|
|||
}
|
||||
|
||||
void ScriptInstance::property_set_fallback(const StringName &, const Variant &, bool *r_valid) {
|
||||
if (r_valid)
|
||||
if (r_valid) {
|
||||
*r_valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
Variant ScriptInstance::property_get_fallback(const StringName &, bool *r_valid) {
|
||||
if (r_valid)
|
||||
if (r_valid) {
|
||||
*r_valid = false;
|
||||
}
|
||||
return Variant();
|
||||
}
|
||||
|
||||
|
@ -332,8 +338,9 @@ void ScriptInstance::call_multilevel(const StringName &p_method, VARIANT_ARG_DEC
|
|||
VARIANT_ARGPTRS;
|
||||
int argc = 0;
|
||||
for (int i = 0; i < VARIANT_ARG_MAX; i++) {
|
||||
if (argptr[i]->get_type() == Variant::NIL)
|
||||
if (argptr[i]->get_type() == Variant::NIL) {
|
||||
break;
|
||||
}
|
||||
argc++;
|
||||
}
|
||||
|
||||
|
@ -370,22 +377,26 @@ int ScriptDebugger::get_depth() const {
|
|||
}
|
||||
|
||||
void ScriptDebugger::insert_breakpoint(int p_line, const StringName &p_source) {
|
||||
if (!breakpoints.has(p_line))
|
||||
if (!breakpoints.has(p_line)) {
|
||||
breakpoints[p_line] = Set<StringName>();
|
||||
}
|
||||
breakpoints[p_line].insert(p_source);
|
||||
}
|
||||
|
||||
void ScriptDebugger::remove_breakpoint(int p_line, const StringName &p_source) {
|
||||
if (!breakpoints.has(p_line))
|
||||
if (!breakpoints.has(p_line)) {
|
||||
return;
|
||||
}
|
||||
|
||||
breakpoints[p_line].erase(p_source);
|
||||
if (breakpoints[p_line].size() == 0)
|
||||
if (breakpoints[p_line].size() == 0) {
|
||||
breakpoints.erase(p_line);
|
||||
}
|
||||
}
|
||||
bool ScriptDebugger::is_breakpoint(int p_line, const StringName &p_source) const {
|
||||
if (!breakpoints.has(p_line))
|
||||
if (!breakpoints.has(p_line)) {
|
||||
return false;
|
||||
}
|
||||
return breakpoints[p_line].has(p_source);
|
||||
}
|
||||
bool ScriptDebugger::is_breakpoint_line(int p_line) const {
|
||||
|
@ -422,8 +433,9 @@ ScriptDebugger::ScriptDebugger() {
|
|||
}
|
||||
|
||||
bool PlaceHolderScriptInstance::set(const StringName &p_name, const Variant &p_value) {
|
||||
if (script->is_placeholder_fallback_enabled())
|
||||
if (script->is_placeholder_fallback_enabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (values.has(p_name)) {
|
||||
Variant defval;
|
||||
|
@ -486,34 +498,39 @@ void PlaceHolderScriptInstance::get_property_list(List<PropertyInfo> *p_properti
|
|||
|
||||
Variant::Type PlaceHolderScriptInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const {
|
||||
if (values.has(p_name)) {
|
||||
if (r_is_valid)
|
||||
if (r_is_valid) {
|
||||
*r_is_valid = true;
|
||||
}
|
||||
return values[p_name].get_type();
|
||||
}
|
||||
|
||||
if (constants.has(p_name)) {
|
||||
if (r_is_valid)
|
||||
if (r_is_valid) {
|
||||
*r_is_valid = true;
|
||||
}
|
||||
return constants[p_name].get_type();
|
||||
}
|
||||
|
||||
if (r_is_valid)
|
||||
if (r_is_valid) {
|
||||
*r_is_valid = false;
|
||||
}
|
||||
|
||||
return Variant::NIL;
|
||||
}
|
||||
|
||||
void PlaceHolderScriptInstance::get_method_list(List<MethodInfo> *p_list) const {
|
||||
if (script->is_placeholder_fallback_enabled())
|
||||
if (script->is_placeholder_fallback_enabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (script.is_valid()) {
|
||||
script->get_script_method_list(p_list);
|
||||
}
|
||||
}
|
||||
bool PlaceHolderScriptInstance::has_method(const StringName &p_method) const {
|
||||
if (script->is_placeholder_fallback_enabled())
|
||||
if (script->is_placeholder_fallback_enabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (script.is_valid()) {
|
||||
return script->has_method(p_method);
|
||||
|
@ -528,8 +545,9 @@ void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, c
|
|||
new_values.insert(n);
|
||||
|
||||
if (!values.has(n) || values[n].get_type() != E->get().type) {
|
||||
if (p_values.has(n))
|
||||
if (p_values.has(n)) {
|
||||
values[n] = p_values[n];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,8 +555,9 @@ void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, c
|
|||
List<StringName> to_remove;
|
||||
|
||||
for (Map<StringName, Variant>::Element *E = values.front(); E; E = E->next()) {
|
||||
if (!new_values.has(E->key()))
|
||||
if (!new_values.has(E->key())) {
|
||||
to_remove.push_back(E->key());
|
||||
}
|
||||
|
||||
Variant defval;
|
||||
if (script->get_property_default_value(E->key(), defval)) {
|
||||
|
@ -585,8 +604,9 @@ void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name,
|
|||
}
|
||||
}
|
||||
|
||||
if (r_valid)
|
||||
if (r_valid) {
|
||||
*r_valid = false; // Cannot change the value in either case
|
||||
}
|
||||
}
|
||||
|
||||
Variant PlaceHolderScriptInstance::property_get_fallback(const StringName &p_name, bool *r_valid) {
|
||||
|
@ -594,21 +614,24 @@ Variant PlaceHolderScriptInstance::property_get_fallback(const StringName &p_nam
|
|||
const Map<StringName, Variant>::Element *E = values.find(p_name);
|
||||
|
||||
if (E) {
|
||||
if (r_valid)
|
||||
if (r_valid) {
|
||||
*r_valid = true;
|
||||
}
|
||||
return E->value();
|
||||
}
|
||||
|
||||
E = constants.find(p_name);
|
||||
if (E) {
|
||||
if (r_valid)
|
||||
if (r_valid) {
|
||||
*r_valid = true;
|
||||
}
|
||||
return E->value();
|
||||
}
|
||||
}
|
||||
|
||||
if (r_valid)
|
||||
if (r_valid) {
|
||||
*r_valid = false;
|
||||
}
|
||||
|
||||
return Variant();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue