diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-09-10 09:01:01 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-09-10 09:01:01 +0800 |
commit | 32d747bd0c20c5b8ee0dedd71eea58b0c12cfe50 (patch) | |
tree | 3e4f27bedc5f2fe0f52a27e41eedb5ce32f057a1 /src/ast | |
parent | f75212eed999502f05605ff747ab71185b2269c5 (diff) | |
download | mrust-32d747bd0c20c5b8ee0dedd71eea58b0c12cfe50.tar.gz |
Parse - Store attributes for trait items
Diffstat (limited to 'src/ast')
-rw-r--r-- | src/ast/ast.cpp | 9 | ||||
-rw-r--r-- | src/ast/ast.hpp | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp index df5f4d5a..a4825a89 100644 --- a/src/ast/ast.cpp +++ b/src/ast/ast.cpp @@ -109,15 +109,18 @@ Function Function::clone() const return rv; } -void Trait::add_type(::std::string name, TypeRef type) { +void Trait::add_type(::std::string name, MetaItems attrs, TypeRef type) { m_items.push_back( Named<Item>(mv$(name), Item::make_Type({TypeAlias(GenericParams(), mv$(type))}), true) ); + m_items.back().data.attrs = mv$(attrs); } -void Trait::add_function(::std::string name, Function fcn) { +void Trait::add_function(::std::string name, MetaItems attrs, Function fcn) { DEBUG("trait fn " << name); m_items.push_back( Named<Item>(mv$(name), Item::make_Function({mv$(fcn)}), true) ); + m_items.back().data.attrs = mv$(attrs); } -void Trait::add_static(::std::string name, Static v) { +void Trait::add_static(::std::string name, MetaItems attrs, Static v) { m_items.push_back( Named<Item>(mv$(name), Item::make_Static({mv$(v)}), true) ); + m_items.back().data.attrs = mv$(attrs); } void Trait::set_is_marker() { m_is_marker = true; diff --git a/src/ast/ast.hpp b/src/ast/ast.hpp index c067001a..09eca0df 100644 --- a/src/ast/ast.hpp +++ b/src/ast/ast.hpp @@ -219,9 +219,9 @@ public: const NamedList<Item>& items() const { return m_items; } NamedList<Item>& items() { return m_items; } - void add_type(::std::string name, TypeRef type); - void add_function(::std::string name, Function fcn); - void add_static(::std::string name, Static v); + void add_type(::std::string name, MetaItems attrs, TypeRef type); + void add_function(::std::string name, MetaItems attrs, Function fcn); + void add_static(::std::string name, MetaItems attrs, Static v); void set_is_marker(); bool is_marker() const; |