summaryrefslogtreecommitdiff
path: root/src/ast
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-03-07 17:12:27 +0800
committerJohn Hodge <tpg@mutabah.net>2016-03-07 17:12:27 +0800
commit8c53ebf221d750a19b0f860584f069b8c3b1733e (patch)
tree544de7b9c384017b012f892e94061672b6320a5c /src/ast
parent30edd863f98df929326f2706c9a2ed32730a225b (diff)
downloadmrust-8c53ebf221d750a19b0f860584f069b8c3b1733e.tar.gz
AST - Correctly move item attributes
Diffstat (limited to 'src/ast')
-rw-r--r--src/ast/ast.cpp3
-rw-r--r--src/ast/ast.hpp2
-rw-r--r--src/ast/generics.hpp2
3 files changed, 6 insertions, 1 deletions
diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp
index a413c64e..35cab7a2 100644
--- a/src/ast/ast.cpp
+++ b/src/ast/ast.cpp
@@ -216,6 +216,7 @@ SERIALISE_TYPE_A(Module::, "AST_Module", {
void Module::add_item(bool is_pub, ::std::string name, Item it, MetaItems attrs) {
m_items.push_back( Named<Item>( mv$(name), mv$(it), is_pub ) );
m_items.back().data.attrs = mv$(attrs);
+ DEBUG("Item " << ::AST::Item::tag_to_str( m_items.back().data.tag() ) << " - attrs = " << m_items.back().data.attrs);
}
void Module::add_ext_crate(::std::string ext_name, ::std::string imp_name, MetaItems attrs) {
// TODO: Extern crates can be public
@@ -245,7 +246,7 @@ void Module::add_function(bool is_public, ::std::string name, Function item, Met
}
void Module::add_submod(bool is_public, Module mod, MetaItems attrs) {
auto name = mod.m_name;
- DEBUG("mod.m_name = " << name);
+ DEBUG("mod.m_name = " << name << ", attrs = " << attrs);
this->add_item( is_public, mv$(name), Item::make_Module({mv$(mod)}), mv$(attrs) );
}
diff --git a/src/ast/ast.hpp b/src/ast/ast.hpp
index 93652a9a..c0ab4b2f 100644
--- a/src/ast/ast.hpp
+++ b/src/ast/ast.hpp
@@ -551,6 +551,8 @@ TAGGED_UNION_EX(Item, (: public Serialisable), None,
Static e;
))
),
+
+ (, attrs(mv$(x.attrs))), (attrs = mv$(x.attrs);),
(
public:
MetaItems attrs;
diff --git a/src/ast/generics.hpp b/src/ast/generics.hpp
index c766fea6..ad205a21 100644
--- a/src/ast/generics.hpp
+++ b/src/ast/generics.hpp
@@ -64,6 +64,8 @@ TAGGED_UNION_EX( GenericBound, (: public Serialisable), Lifetime,
TypeRef replacement;
))
),
+
+ (), (),
(
public:
SERIALISABLE_PROTOTYPES();