Fix alias template creation
This commit is contained in:
parent
d089dd97b7
commit
535b088123
4 changed files with 18 additions and 8 deletions
|
|
@ -28,12 +28,14 @@ namespace cppast
|
|||
}
|
||||
|
||||
private:
|
||||
cpp_alias_template(std::string name, std::unique_ptr<cpp_type_alias> alias)
|
||||
: cpp_template(std::move(name), std::unique_ptr<cpp_entity>(alias.release()))
|
||||
cpp_alias_template(std::unique_ptr<cpp_type_alias> alias)
|
||||
: cpp_template(std::unique_ptr<cpp_entity>(alias.release()))
|
||||
{
|
||||
}
|
||||
|
||||
cpp_entity_kind do_get_entity_kind() const noexcept override;
|
||||
|
||||
friend basic_builder<cpp_alias_template, cpp_type_alias>;
|
||||
};
|
||||
} // namespace cppast
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ namespace cppast
|
|||
{
|
||||
public:
|
||||
/// \effects Sets the name and the entity that is begin templated.
|
||||
basic_builder(std::string name, std::unique_ptr<EntityT> templ)
|
||||
: template_entity(new T(name, std::move(templ)))
|
||||
basic_builder(std::unique_ptr<EntityT> templ) : template_entity(new T(std::move(templ)))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -62,8 +61,7 @@ namespace cppast
|
|||
|
||||
/// \effects Sets the name of the template and the entity to be templated.
|
||||
/// \notes It does not include the parameters.
|
||||
cpp_template(std::string name, std::unique_ptr<cpp_entity> entity)
|
||||
: cpp_entity(std::move(name))
|
||||
cpp_template(std::unique_ptr<cpp_entity> entity) : cpp_entity(entity->name())
|
||||
{
|
||||
add_child(std::move(entity));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@ namespace cppast
|
|||
std::string name,
|
||||
std::unique_ptr<cpp_type> type);
|
||||
|
||||
/// \returns A newly created type alias that isn't registered.
|
||||
/// \notes This function is intendend for templated type aliases.
|
||||
static std::unique_ptr<cpp_type_alias> build(std::string name,
|
||||
std::unique_ptr<cpp_type> type);
|
||||
|
||||
/// \returns A reference to the aliased [cppast::cpp_type]().
|
||||
const cpp_type& underlying_type() const noexcept
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,12 +12,17 @@ std::unique_ptr<cpp_type_alias> cpp_type_alias::build(const cpp_entity_index& id
|
|||
std::string name,
|
||||
std::unique_ptr<cpp_type> type)
|
||||
{
|
||||
auto result =
|
||||
std::unique_ptr<cpp_type_alias>(new cpp_type_alias(std::move(name), std::move(type)));
|
||||
auto result = build(std::move(name), std::move(type));
|
||||
idx.register_entity(std::move(id), type_safe::cref(*result));
|
||||
return result;
|
||||
}
|
||||
|
||||
std::unique_ptr<cpp_type_alias> cpp_type_alias::build(std::string name,
|
||||
std::unique_ptr<cpp_type> type)
|
||||
{
|
||||
return std::unique_ptr<cpp_type_alias>(new cpp_type_alias(std::move(name), std::move(type)));
|
||||
}
|
||||
|
||||
cpp_entity_kind cpp_type_alias::do_get_entity_kind() const noexcept
|
||||
{
|
||||
return cpp_entity_kind::type_alias_t;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue