diff options
Diffstat (limited to 'modules/mono')
-rw-r--r-- | modules/mono/csharp_script.cpp | 8 | ||||
-rw-r--r-- | modules/mono/editor/bindings_generator.cpp | 24 | ||||
-rw-r--r-- | modules/mono/editor/godotsharp_export.cpp | 4 | ||||
-rw-r--r-- | modules/mono/editor/script_class_parser.cpp | 6 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono_internals.cpp | 9 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono_marshal.cpp | 78 |
6 files changed, 63 insertions, 66 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 9c127b837d..51615df64e 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -719,13 +719,13 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { // Script::instances are deleted during managed object disposal, which happens on domain finalize. // Only placeholders are kept. Therefore we need to keep a copy before that happens. - for (Set<Object *>::Element *E = script->instances.front(); E; E = E->next()) { - script->pending_reload_instances.insert(E->get()->get_instance_id()); + for (Set<Object *>::Element *F = script->instances.front(); F; F = F->next()) { + script->pending_reload_instances.insert(F->get()->get_instance_id()); } #ifdef TOOLS_ENABLED - for (Set<PlaceHolderScriptInstance *>::Element *E = script->placeholders.front(); E; E = E->next()) { - script->pending_reload_instances.insert(E->get()->get_owner()->get_instance_id()); + for (Set<PlaceHolderScriptInstance *>::Element *F = script->placeholders.front(); F; F = F->next()) { + script->pending_reload_instances.insert(F->get()->get_owner()->get_instance_id()); } #endif diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 2161b15591..cffccd5cb5 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -365,8 +365,8 @@ void BindingsGenerator::_generate_global_constants(List<String> &p_output) { p_output.push_back(enum_proxy_name); p_output.push_back("\n" INDENT1 OPEN_BLOCK); - for (const List<ConstantInterface>::Element *E = ienum.constants.front(); E; E = E->next()) { - const ConstantInterface &iconstant = E->get(); + for (const List<ConstantInterface>::Element *F = ienum.constants.front(); F; F = F->next()) { + const ConstantInterface &iconstant = F->get(); if (iconstant.const_doc && iconstant.const_doc->description.size()) { p_output.push_back(INDENT2 "/// <summary>\n"); @@ -389,7 +389,7 @@ void BindingsGenerator::_generate_global_constants(List<String> &p_output) { p_output.push_back(iconstant.proxy_name); p_output.push_back(" = "); p_output.push_back(itos(iconstant.value)); - p_output.push_back(E != ienum.constants.back() ? ",\n" : "\n"); + p_output.push_back(F != ienum.constants.back() ? ",\n" : "\n"); } p_output.push_back(INDENT1 CLOSE_BLOCK); @@ -472,8 +472,6 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_solution_dir, String output_dir = output_file.get_base_dir(); if (!DirAccess::exists(output_dir)) { - DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - ERR_FAIL_COND_V(!da, ERR_CANT_CREATE); Error err = da->make_dir_recursive(ProjectSettings::get_singleton()->globalize_path(output_dir)); ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE); } @@ -806,8 +804,8 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str output.push_back(ienum.cname.operator String()); output.push_back(MEMBER_BEGIN OPEN_BLOCK); - for (const List<ConstantInterface>::Element *E = ienum.constants.front(); E; E = E->next()) { - const ConstantInterface &iconstant = E->get(); + for (const List<ConstantInterface>::Element *F = ienum.constants.front(); F; F = F->next()) { + const ConstantInterface &iconstant = F->get(); if (iconstant.const_doc && iconstant.const_doc->description.size()) { output.push_back(INDENT3 "/// <summary>\n"); @@ -830,7 +828,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str output.push_back(iconstant.proxy_name); output.push_back(" = "); output.push_back(itos(iconstant.value)); - output.push_back(E != ienum.constants.back() ? ",\n" : "\n"); + output.push_back(F != ienum.constants.back() ? ",\n" : "\n"); } output.push_back(INDENT2 CLOSE_BLOCK); @@ -1889,8 +1887,8 @@ void BindingsGenerator::_populate_object_type_interfaces() { } if (!imethod.is_virtual && imethod.name[0] == '_') { - for (const List<PropertyInterface>::Element *E = itype.properties.front(); E; E = E->next()) { - const PropertyInterface &iprop = E->get(); + for (const List<PropertyInterface>::Element *F = itype.properties.front(); F; F = F->next()) { + const PropertyInterface &iprop = F->get(); if (iprop.setter == imethod.name || iprop.getter == imethod.name) { imethod.is_internal = true; @@ -2352,9 +2350,9 @@ void BindingsGenerator::_populate_global_constants() { if (enum_name != StringName()) { EnumInterface ienum(enum_name); - List<EnumInterface>::Element *match = global_enums.find(ienum); - if (match) { - match->get().constants.push_back(iconstant); + List<EnumInterface>::Element *enum_match = global_enums.find(ienum); + if (enum_match) { + enum_match->get().constants.push_back(iconstant); } else { ienum.constants.push_back(iconstant); global_enums.push_back(ienum); diff --git a/modules/mono/editor/godotsharp_export.cpp b/modules/mono/editor/godotsharp_export.cpp index 7e2487a6e7..ee5fed1a0c 100644 --- a/modules/mono/editor/godotsharp_export.cpp +++ b/modules/mono/editor/godotsharp_export.cpp @@ -194,8 +194,8 @@ Error GodotSharpExport::_get_assembly_dependencies(GDMonoAssembly *p_assembly, c String path; bool has_extension = ref_name.ends_with(".dll") || ref_name.ends_with(".exe"); - for (int i = 0; i < p_search_dirs.size(); i++) { - const String &search_dir = p_search_dirs[i]; + for (int j = 0; j < p_search_dirs.size(); j++) { + const String &search_dir = p_search_dirs[j]; if (has_extension) { path = search_dir.plus_file(ref_name); diff --git a/modules/mono/editor/script_class_parser.cpp b/modules/mono/editor/script_class_parser.cpp index 1281ed669f..53a043b675 100644 --- a/modules/mono/editor/script_class_parser.cpp +++ b/modules/mono/editor/script_class_parser.cpp @@ -346,7 +346,7 @@ Error ScriptClassParser::_parse_class_base(Vector<String> &r_base) { bool generic = false; if (tk == TK_OP_LESS) { - Error err = _skip_generic_type_params(); + err = _skip_generic_type_params(); if (err) return err; // We don't add it to the base list if it's generic @@ -355,11 +355,11 @@ Error ScriptClassParser::_parse_class_base(Vector<String> &r_base) { } if (tk == TK_COMMA) { - Error err = _parse_class_base(r_base); + err = _parse_class_base(r_base); if (err) return err; } else if (tk == TK_IDENTIFIER && String(value) == "where") { - Error err = _parse_type_constraints(); + err = _parse_type_constraints(); if (err) { return err; } diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp index 14ec24466b..c8cba5cf1b 100644 --- a/modules/mono/mono_gd/gd_mono_internals.cpp +++ b/modules/mono/mono_gd/gd_mono_internals.cpp @@ -75,14 +75,14 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) { script_binding.wrapper_class = klass; script_binding.gchandle = MonoGCHandle::create_strong(managed); - Reference *ref = Object::cast_to<Reference>(unmanaged); - if (ref) { + Reference *kref = Object::cast_to<Reference>(unmanaged); + if (kref) { // Unsafe refcount increment. The managed instance also counts as a reference. // This way if the unmanaged world has no references to our owner // but the managed instance is alive, the refcount will be 1 instead of 0. // See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr) - ref->reference(); + kref->reference(); } // The object was just created, no script instance binding should have been attached @@ -96,8 +96,7 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) { return; } - Ref<MonoGCHandle> gchandle = ref ? MonoGCHandle::create_weak(managed) : - MonoGCHandle::create_strong(managed); + Ref<MonoGCHandle> gchandle = ref ? MonoGCHandle::create_weak(managed) : MonoGCHandle::create_strong(managed); Ref<CSharpScript> script = CSharpScript::create_for_managed_type(klass, native); diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 18a49d0d1f..7fe8ae608a 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -68,39 +68,39 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { } break; case MONO_TYPE_VALUETYPE: { - GDMonoClass *tclass = p_type.type_class; + GDMonoClass *vtclass = p_type.type_class; - if (tclass == CACHED_CLASS(Vector2)) + if (vtclass == CACHED_CLASS(Vector2)) return Variant::VECTOR2; - if (tclass == CACHED_CLASS(Rect2)) + if (vtclass == CACHED_CLASS(Rect2)) return Variant::RECT2; - if (tclass == CACHED_CLASS(Transform2D)) + if (vtclass == CACHED_CLASS(Transform2D)) return Variant::TRANSFORM2D; - if (tclass == CACHED_CLASS(Vector3)) + if (vtclass == CACHED_CLASS(Vector3)) return Variant::VECTOR3; - if (tclass == CACHED_CLASS(Basis)) + if (vtclass == CACHED_CLASS(Basis)) return Variant::BASIS; - if (tclass == CACHED_CLASS(Quat)) + if (vtclass == CACHED_CLASS(Quat)) return Variant::QUAT; - if (tclass == CACHED_CLASS(Transform)) + if (vtclass == CACHED_CLASS(Transform)) return Variant::TRANSFORM; - if (tclass == CACHED_CLASS(AABB)) + if (vtclass == CACHED_CLASS(AABB)) return Variant::AABB; - if (tclass == CACHED_CLASS(Color)) + if (vtclass == CACHED_CLASS(Color)) return Variant::COLOR; - if (tclass == CACHED_CLASS(Plane)) + if (vtclass == CACHED_CLASS(Plane)) return Variant::PLANE; - if (mono_class_is_enum(tclass->get_mono_ptr())) + if (mono_class_is_enum(vtclass->get_mono_ptr())) return Variant::INT; } break; @@ -294,60 +294,60 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty } break; case MONO_TYPE_VALUETYPE: { - GDMonoClass *tclass = p_type.type_class; + GDMonoClass *vtclass = p_type.type_class; - if (tclass == CACHED_CLASS(Vector2)) { + if (vtclass == CACHED_CLASS(Vector2)) { GDMonoMarshal::M_Vector2 from = MARSHALLED_OUT(Vector2, p_var->operator ::Vector2()); return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Vector2), &from); } - if (tclass == CACHED_CLASS(Rect2)) { + if (vtclass == CACHED_CLASS(Rect2)) { GDMonoMarshal::M_Rect2 from = MARSHALLED_OUT(Rect2, p_var->operator ::Rect2()); return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Rect2), &from); } - if (tclass == CACHED_CLASS(Transform2D)) { + if (vtclass == CACHED_CLASS(Transform2D)) { GDMonoMarshal::M_Transform2D from = MARSHALLED_OUT(Transform2D, p_var->operator ::Transform2D()); return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Transform2D), &from); } - if (tclass == CACHED_CLASS(Vector3)) { + if (vtclass == CACHED_CLASS(Vector3)) { GDMonoMarshal::M_Vector3 from = MARSHALLED_OUT(Vector3, p_var->operator ::Vector3()); return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Vector3), &from); } - if (tclass == CACHED_CLASS(Basis)) { + if (vtclass == CACHED_CLASS(Basis)) { GDMonoMarshal::M_Basis from = MARSHALLED_OUT(Basis, p_var->operator ::Basis()); return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Basis), &from); } - if (tclass == CACHED_CLASS(Quat)) { + if (vtclass == CACHED_CLASS(Quat)) { GDMonoMarshal::M_Quat from = MARSHALLED_OUT(Quat, p_var->operator ::Quat()); return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Quat), &from); } - if (tclass == CACHED_CLASS(Transform)) { + if (vtclass == CACHED_CLASS(Transform)) { GDMonoMarshal::M_Transform from = MARSHALLED_OUT(Transform, p_var->operator ::Transform()); return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Transform), &from); } - if (tclass == CACHED_CLASS(AABB)) { + if (vtclass == CACHED_CLASS(AABB)) { GDMonoMarshal::M_AABB from = MARSHALLED_OUT(AABB, p_var->operator ::AABB()); return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(AABB), &from); } - if (tclass == CACHED_CLASS(Color)) { + if (vtclass == CACHED_CLASS(Color)) { GDMonoMarshal::M_Color from = MARSHALLED_OUT(Color, p_var->operator ::Color()); return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Color), &from); } - if (tclass == CACHED_CLASS(Plane)) { + if (vtclass == CACHED_CLASS(Plane)) { GDMonoMarshal::M_Plane from = MARSHALLED_OUT(Plane, p_var->operator ::Plane()); return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Plane), &from); } - if (mono_class_is_enum(tclass->get_mono_ptr())) { - MonoType *enum_basetype = mono_class_enum_basetype(tclass->get_mono_ptr()); + if (mono_class_is_enum(vtclass->get_mono_ptr())) { + MonoType *enum_basetype = mono_class_enum_basetype(vtclass->get_mono_ptr()); MonoClass *enum_baseclass = mono_class_from_mono_type(enum_basetype); switch (mono_type_get_type(enum_basetype)) { case MONO_TYPE_BOOLEAN: { @@ -624,39 +624,39 @@ Variant mono_object_to_variant(MonoObject *p_obj) { } break; case MONO_TYPE_VALUETYPE: { - GDMonoClass *tclass = type.type_class; + GDMonoClass *vtclass = type.type_class; - if (tclass == CACHED_CLASS(Vector2)) + if (vtclass == CACHED_CLASS(Vector2)) return MARSHALLED_IN(Vector2, (GDMonoMarshal::M_Vector2 *)mono_object_unbox(p_obj)); - if (tclass == CACHED_CLASS(Rect2)) + if (vtclass == CACHED_CLASS(Rect2)) return MARSHALLED_IN(Rect2, (GDMonoMarshal::M_Rect2 *)mono_object_unbox(p_obj)); - if (tclass == CACHED_CLASS(Transform2D)) + if (vtclass == CACHED_CLASS(Transform2D)) return MARSHALLED_IN(Transform2D, (GDMonoMarshal::M_Transform2D *)mono_object_unbox(p_obj)); - if (tclass == CACHED_CLASS(Vector3)) + if (vtclass == CACHED_CLASS(Vector3)) return MARSHALLED_IN(Vector3, (GDMonoMarshal::M_Vector3 *)mono_object_unbox(p_obj)); - if (tclass == CACHED_CLASS(Basis)) + if (vtclass == CACHED_CLASS(Basis)) return MARSHALLED_IN(Basis, (GDMonoMarshal::M_Basis *)mono_object_unbox(p_obj)); - if (tclass == CACHED_CLASS(Quat)) + if (vtclass == CACHED_CLASS(Quat)) return MARSHALLED_IN(Quat, (GDMonoMarshal::M_Quat *)mono_object_unbox(p_obj)); - if (tclass == CACHED_CLASS(Transform)) + if (vtclass == CACHED_CLASS(Transform)) return MARSHALLED_IN(Transform, (GDMonoMarshal::M_Transform *)mono_object_unbox(p_obj)); - if (tclass == CACHED_CLASS(AABB)) + if (vtclass == CACHED_CLASS(AABB)) return MARSHALLED_IN(AABB, (GDMonoMarshal::M_AABB *)mono_object_unbox(p_obj)); - if (tclass == CACHED_CLASS(Color)) + if (vtclass == CACHED_CLASS(Color)) return MARSHALLED_IN(Color, (GDMonoMarshal::M_Color *)mono_object_unbox(p_obj)); - if (tclass == CACHED_CLASS(Plane)) + if (vtclass == CACHED_CLASS(Plane)) return MARSHALLED_IN(Plane, (GDMonoMarshal::M_Plane *)mono_object_unbox(p_obj)); - if (mono_class_is_enum(tclass->get_mono_ptr())) + if (mono_class_is_enum(vtclass->get_mono_ptr())) return unbox<int32_t>(p_obj); } break; @@ -740,7 +740,7 @@ Variant mono_object_to_variant(MonoObject *p_obj) { UNLIKELY_UNHANDLED_EXCEPTION(exc); if (is_dict) { - MonoException *exc = NULL; + exc = NULL; MonoObject *ret = type.type_class->get_method("GetPtr")->invoke(p_obj, &exc); UNLIKELY_UNHANDLED_EXCEPTION(exc); return *unbox<Dictionary *>(ret); @@ -753,7 +753,7 @@ Variant mono_object_to_variant(MonoObject *p_obj) { UNLIKELY_UNHANDLED_EXCEPTION(exc); if (is_array) { - MonoException *exc = NULL; + exc = NULL; MonoObject *ret = type.type_class->get_method("GetPtr")->invoke(p_obj, &exc); UNLIKELY_UNHANDLED_EXCEPTION(exc); return *unbox<Array *>(ret); |