Minor refactoring variable names

This commit is contained in:
Bartek Kryza
2021-10-03 18:40:17 +02:00
parent 7615d465f0
commit e3fdebdba9
3 changed files with 20 additions and 18 deletions

View File

@@ -43,9 +43,9 @@ std::string method_parameter::to_string(
using namespace clanguml::util; using namespace clanguml::util;
auto t = ns_relative(using_namespaces, type()); auto t = ns_relative(using_namespaces, type());
if (default_value().empty()) if (default_value().empty())
return t + " " + name(); return fmt::format("{} {}", t, name());
return t + " " + name() + " = " + default_value(); return fmt::format("{} {} = {}", t, name(), default_value());
} }
} }

View File

@@ -64,11 +64,11 @@ translation_unit_context::get_type_alias(const std::string &full_name) const
type_safe::object_ref<const cppast::cpp_type> type_safe::object_ref<const cppast::cpp_type>
translation_unit_context::get_type_alias_final(const cppast::cpp_type &t) const translation_unit_context::get_type_alias_final(const cppast::cpp_type &t) const
{ {
const auto fn = const auto type_full_name =
cx::util::full_name(cppast::remove_cv(t), entity_index_, false); cx::util::full_name(cppast::remove_cv(t), entity_index_, false);
if (has_type_alias(fn)) { if (has_type_alias(type_full_name)) {
return get_type_alias_final(alias_index_.at(fn).get()); return get_type_alias_final(alias_index_.at(type_full_name).get());
} }
return type_safe::ref(t); return type_safe::ref(t);

View File

@@ -51,24 +51,25 @@ using clanguml::class_diagram::model::scope_t;
using clanguml::class_diagram::model::type_alias; using clanguml::class_diagram::model::type_alias;
namespace detail { namespace detail {
scope_t cpp_access_specifier_to_scope(cppast::cpp_access_specifier_kind as) scope_t cpp_access_specifier_to_scope(
cppast::cpp_access_specifier_kind access_specifier)
{ {
scope_t res = scope_t::kPublic; scope_t scope = scope_t::kPublic;
switch (as) { switch (access_specifier) {
case cppast::cpp_access_specifier_kind::cpp_public: case cppast::cpp_access_specifier_kind::cpp_public:
res = scope_t::kPublic; scope = scope_t::kPublic;
break; break;
case cppast::cpp_access_specifier_kind::cpp_private: case cppast::cpp_access_specifier_kind::cpp_private:
res = scope_t::kPrivate; scope = scope_t::kPrivate;
break; break;
case cppast::cpp_access_specifier_kind::cpp_protected: case cppast::cpp_access_specifier_kind::cpp_protected:
res = scope_t::kProtected; scope = scope_t::kProtected;
break; break;
default: default:
break; break;
} }
return res; return scope;
} }
} }
@@ -1440,15 +1441,16 @@ class_ translation_unit_visitor::build_template_instantiation(
} }
const cppast::cpp_type &translation_unit_visitor::resolve_alias( const cppast::cpp_type &translation_unit_visitor::resolve_alias(
const cppast::cpp_type &t) const cppast::cpp_type &type)
{ {
const auto &tt = cppast::remove_cv(cx::util::unreferenced(t)); const auto &raw_type = cppast::remove_cv(cx::util::unreferenced(type));
const auto fn = cx::util::full_name(tt, ctx.entity_index(), false); const auto type_full_name =
if (ctx.has_type_alias(fn)) { cx::util::full_name(raw_type, ctx.entity_index(), false);
return ctx.get_type_alias_final(tt).get(); if (ctx.has_type_alias(type_full_name)) {
return ctx.get_type_alias_final(raw_type).get();
} }
return t; return type;
} }
} }