clang-format: Enable BreakBeforeTernaryOperators

clang-format keeps breaking the way it handles break *after* ternary operators,
so I give up and go with the only style they seem to actually test.
This commit is contained in:
Rémi Verschelde 2021-10-28 15:57:41 +02:00
parent 3a6be64c12
commit 0ae65472e7
No known key found for this signature in database
GPG key ID: C3336907360768E1
15 changed files with 68 additions and 87 deletions

View file

@ -3528,10 +3528,10 @@ Error CSharpScript::load_source_code(const String &p_path) {
Error ferr = read_all_file_utf8(p_path, source);
ERR_FAIL_COND_V_MSG(ferr != OK, ferr,
ferr == ERR_INVALID_DATA ?
"Script '" + p_path + "' contains invalid unicode (UTF-8), so it was not loaded."
" Please ensure that scripts are saved in valid UTF-8 unicode." :
"Failed to read file: '" + p_path + "'.");
ferr == ERR_INVALID_DATA
? "Script '" + p_path + "' contains invalid unicode (UTF-8), so it was not loaded."
" Please ensure that scripts are saved in valid UTF-8 unicode."
: "Failed to read file: '" + p_path + "'.");
#ifdef TOOLS_ENABLED
source_changed_cache = true;

View file

@ -365,8 +365,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
xml_output.append(link_target);
xml_output.append("</c>");
} else if (link_tag == "enum") {
StringName search_cname = !target_itype ? target_cname :
StringName(target_itype->name + "." + (String)target_cname);
StringName search_cname = !target_itype ? target_cname : StringName(target_itype->name + "." + (String)target_cname);
const Map<StringName, TypeInterface>::Element *enum_match = enum_types.find(search_cname);

View file

@ -592,9 +592,9 @@ bool GDMono::load_assembly_from(const String &p_name, const String &p_path, GDMo
ApiAssemblyInfo::Version ApiAssemblyInfo::Version::get_from_loaded_assembly(GDMonoAssembly *p_api_assembly, ApiAssemblyInfo::Type p_api_type) {
ApiAssemblyInfo::Version api_assembly_version;
const char *nativecalls_name = p_api_type == ApiAssemblyInfo::API_CORE ?
BINDINGS_CLASS_NATIVECALLS :
BINDINGS_CLASS_NATIVECALLS_EDITOR;
const char *nativecalls_name = p_api_type == ApiAssemblyInfo::API_CORE
? BINDINGS_CLASS_NATIVECALLS
: BINDINGS_CLASS_NATIVECALLS_EDITOR;
GDMonoClass *nativecalls_klass = p_api_assembly->get_class(BINDINGS_NAMESPACE, nativecalls_name);
@ -754,14 +754,10 @@ bool GDMono::_temp_domain_load_are_assemblies_out_of_sync(const String &p_config
}
String GDMono::update_api_assemblies_from_prebuilt(const String &p_config, const bool *p_core_api_out_of_sync, const bool *p_editor_api_out_of_sync) {
#define FAIL_REASON(m_out_of_sync, m_prebuilt_exists) \
( \
(m_out_of_sync ? \
String("The assembly is invalidated ") : \
String("The assembly was not found ")) + \
(m_prebuilt_exists ? \
String("and the prebuilt assemblies are missing.") : \
String("and we failed to copy the prebuilt assemblies.")))
#define FAIL_REASON(m_out_of_sync, m_prebuilt_exists) \
( \
(m_out_of_sync ? String("The assembly is invalidated ") : String("The assembly was not found ")) + \
(m_prebuilt_exists ? String("and the prebuilt assemblies are missing.") : String("and we failed to copy the prebuilt assemblies.")))
String dst_assemblies_dir = GodotSharpDirs::get_res_assemblies_base_dir().plus_file(p_config);
@ -819,9 +815,9 @@ bool GDMono::_load_core_api_assembly(LoadedApiAssembly &r_loaded_api_assembly, c
// For the editor and the editor player we want to load it from a specific path to make sure we can keep it up to date
// If running the project manager, load it from the prebuilt API directory
String assembly_dir = !Main::is_project_manager() ?
GodotSharpDirs::get_res_assemblies_base_dir().plus_file(p_config) :
GodotSharpDirs::get_data_editor_prebuilt_api_dir().plus_file(p_config);
String assembly_dir = !Main::is_project_manager()
? GodotSharpDirs::get_res_assemblies_base_dir().plus_file(p_config)
: GodotSharpDirs::get_data_editor_prebuilt_api_dir().plus_file(p_config);
String assembly_path = assembly_dir.plus_file(CORE_API_ASSEMBLY_NAME ".dll");
@ -852,9 +848,9 @@ bool GDMono::_load_editor_api_assembly(LoadedApiAssembly &r_loaded_api_assembly,
// For the editor and the editor player we want to load it from a specific path to make sure we can keep it up to date
// If running the project manager, load it from the prebuilt API directory
String assembly_dir = !Main::is_project_manager() ?
GodotSharpDirs::get_res_assemblies_base_dir().plus_file(p_config) :
GodotSharpDirs::get_data_editor_prebuilt_api_dir().plus_file(p_config);
String assembly_dir = !Main::is_project_manager()
? GodotSharpDirs::get_res_assemblies_base_dir().plus_file(p_config)
: GodotSharpDirs::get_data_editor_prebuilt_api_dir().plus_file(p_config);
String assembly_path = assembly_dir.plus_file(EDITOR_API_ASSEMBLY_NAME ".dll");

View file

@ -1736,12 +1736,12 @@ Callable managed_to_callable(const M_Callable &p_managed_callable) {
CallableCustom *managed_callable = memnew(ManagedCallable(p_managed_callable.delegate));
return Callable(managed_callable);
} else {
Object *target = p_managed_callable.target ?
unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_managed_callable.target)) :
nullptr;
StringName *method_ptr = p_managed_callable.method_string_name ?
unbox<StringName *>(CACHED_FIELD(StringName, ptr)->get_value(p_managed_callable.method_string_name)) :
nullptr;
Object *target = p_managed_callable.target
? unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_managed_callable.target))
: nullptr;
StringName *method_ptr = p_managed_callable.method_string_name
? unbox<StringName *>(CACHED_FIELD(StringName, ptr)->get_value(p_managed_callable.method_string_name))
: nullptr;
StringName method = method_ptr ? *method_ptr : StringName();
return Callable(target, method);
}
@ -1784,12 +1784,12 @@ M_Callable callable_to_managed(const Callable &p_callable) {
}
Signal managed_to_signal_info(const M_SignalInfo &p_managed_signal) {
Object *owner = p_managed_signal.owner ?
unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_managed_signal.owner)) :
nullptr;
StringName *name_ptr = p_managed_signal.name_string_name ?
unbox<StringName *>(CACHED_FIELD(StringName, ptr)->get_value(p_managed_signal.name_string_name)) :
nullptr;
Object *owner = p_managed_signal.owner
? unbox<Object *>(CACHED_FIELD(GodotObject, ptr)->get_value(p_managed_signal.owner))
: nullptr;
StringName *name_ptr = p_managed_signal.name_string_name
? unbox<StringName *>(CACHED_FIELD(StringName, ptr)->get_value(p_managed_signal.name_string_name))
: nullptr;
StringName name = name_ptr ? *name_ptr : StringName();
return Signal(owner, name);
}