Add cpp_variable
This commit is contained in:
parent
4b69e823c8
commit
664b5a6d4e
5 changed files with 89 additions and 0 deletions
25
src/cpp_variable.cpp
Normal file
25
src/cpp_variable.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright (C) 2017 Jonathan Müller <jonathanmueller.dev@gmail.com>
|
||||
// This file is subject to the license terms in the LICENSE file
|
||||
// found in the top-level directory of this distribution.
|
||||
|
||||
#include <cppast/cpp_variable.hpp>
|
||||
|
||||
#include <cppast/cpp_entity_kind.hpp>
|
||||
|
||||
using namespace cppast;
|
||||
|
||||
std::unique_ptr<cpp_variable> cpp_variable::build(const cpp_entity_index& idx, cpp_entity_id id,
|
||||
std::string name, std::unique_ptr<cpp_type> type,
|
||||
std::unique_ptr<cpp_expression> def,
|
||||
cpp_variable_specifiers spec)
|
||||
{
|
||||
auto result = std::unique_ptr<cpp_variable>(
|
||||
new cpp_variable(std::move(name), std::move(type), std::move(def), spec));
|
||||
idx.register_entity(std::move(id), type_safe::cref(*result));
|
||||
return result;
|
||||
}
|
||||
|
||||
cpp_entity_kind cpp_variable::do_get_entity_kind() const noexcept
|
||||
{
|
||||
return cpp_entity_kind::variable_t;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue