Fixed return message generation in sequence diagrams

This commit is contained in:
Bartek Kryza
2021-10-16 10:40:43 +02:00
parent 10e8423fbd
commit bfc7b49fdd
2 changed files with 8 additions and 3 deletions

View File

@@ -69,6 +69,8 @@ void generator::generate_call(const message &m, std::ostream &ostr) const
void generator::generate_return(const message &m, std::ostream &ostr) const
{
// Add return activity only for messages between different actors and
// only if the return type is different than void
if ((m.from != m.to) && (m.return_type != "void")) {
const auto from = ns_relative(m_config.using_namespace, m.from);
const auto to = ns_relative(m_config.using_namespace, m.to);

View File

@@ -100,12 +100,15 @@ void translation_unit_visitor::process_activities(const cppast::cpp_function &e)
m.to_usr = type_safe::get(function_call.get_callee_method_id());
const auto &callee_method =
ctx.entity_index()
.lookup_definition(function_call.get_callee_method_id())
.value();
static_cast<const cppast::cpp_member_function &>(
ctx.entity_index()
.lookup_definition(function_call.get_callee_method_id())
.value());
m.message = callee_method.name();
m.return_type = cppast::to_string(callee_method.return_type());
if (ctx.diagram().sequences.find(m.from_usr) ==
ctx.diagram().sequences.end()) {
activity a;