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;
auto t = ns_relative(using_namespaces, type());
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>
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);
if (has_type_alias(fn)) {
return get_type_alias_final(alias_index_.at(fn).get());
if (has_type_alias(type_full_name)) {
return get_type_alias_final(alias_index_.at(type_full_name).get());
}
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;
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;
switch (as) {
scope_t scope = scope_t::kPublic;
switch (access_specifier) {
case cppast::cpp_access_specifier_kind::cpp_public:
res = scope_t::kPublic;
scope = scope_t::kPublic;
break;
case cppast::cpp_access_specifier_kind::cpp_private:
res = scope_t::kPrivate;
scope = scope_t::kPrivate;
break;
case cppast::cpp_access_specifier_kind::cpp_protected:
res = scope_t::kProtected;
scope = scope_t::kProtected;
break;
default:
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 &t)
const cppast::cpp_type &type)
{
const auto &tt = cppast::remove_cv(cx::util::unreferenced(t));
const auto fn = cx::util::full_name(tt, ctx.entity_index(), false);
if (ctx.has_type_alias(fn)) {
return ctx.get_type_alias_final(tt).get();
const auto &raw_type = cppast::remove_cv(cx::util::unreferenced(type));
const auto type_full_name =
cx::util::full_name(raw_type, ctx.entity_index(), false);
if (ctx.has_type_alias(type_full_name)) {
return ctx.get_type_alias_final(raw_type).get();
}
return t;
return type;
}
}