1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Mono/C#: Fix several clang-tidy warnings and cleanup

This commit is contained in:
Ignacio Etcheverry
2020-07-05 19:19:36 +02:00
parent 772f693e5b
commit 2511c43972
48 changed files with 935 additions and 1205 deletions

View File

@@ -45,8 +45,9 @@ _FORCE_INLINE_ String quoted(const String &p_str) {
}
void _add_nodes_suggestions(const Node *p_base, const Node *p_node, PackedStringArray &r_suggestions) {
if (p_node != p_base && !p_node->get_owner())
if (p_node != p_base && !p_node->get_owner()) {
return;
}
String path_relative_to_orig = p_base->get_path_to(p_node);
@@ -58,18 +59,21 @@ void _add_nodes_suggestions(const Node *p_base, const Node *p_node, PackedString
}
Node *_find_node_for_script(Node *p_base, Node *p_current, const Ref<Script> &p_script) {
if (p_current->get_owner() != p_base && p_base != p_current)
if (p_current->get_owner() != p_base && p_base != p_current) {
return nullptr;
}
Ref<Script> c = p_current->get_script();
if (c == p_script)
if (c == p_script) {
return p_current;
}
for (int i = 0; i < p_current->get_child_count(); i++) {
Node *found = _find_node_for_script(p_base, p_current->get_child(i), p_script);
if (found)
if (found) {
return found;
}
}
return nullptr;
@@ -87,8 +91,9 @@ void _get_directory_contents(EditorFileSystemDirectory *p_dir, PackedStringArray
Node *_try_find_owner_node_in_tree(const Ref<Script> p_script) {
SceneTree *tree = SceneTree::get_singleton();
if (!tree)
if (!tree) {
return nullptr;
}
Node *base = tree->get_edited_scene_root();
if (base) {
base = _find_node_for_script(base, base, p_script);
@@ -107,8 +112,9 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
for (List<PropertyInfo>::Element *E = project_props.front(); E; E = E->next()) {
const PropertyInfo &prop = E->get();
if (!prop.name.begins_with("input/"))
if (!prop.name.begins_with("input/")) {
continue;
}
String name = prop.name.substr(prop.name.find("/") + 1, prop.name.length());
suggestions.push_back(quoted(name));