summaryrefslogtreecommitdiff
path: root/src/expand
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2018-05-20 15:02:17 +0800
committerJohn Hodge <tpg@mutabah.net>2018-05-20 15:02:17 +0800
commit1c50e757b45f64ead016d6cd2bf27585ba5dce04 (patch)
treeb90d54a4698355112aa9204da15b5b7f7ff940d2 /src/expand
parent7a4733c76c0391578fe04fde9cfa19698878c81e (diff)
downloadmrust-1c50e757b45f64ead016d6cd2bf27585ba5dce04.tar.gz
AST - Rename MetaItem and MetaItems to Attribute and AttributeList
Diffstat (limited to 'src/expand')
-rw-r--r--src/expand/cfg.cpp20
-rw-r--r--src/expand/cfg.hpp2
-rw-r--r--src/expand/crate_tags.cpp10
-rw-r--r--src/expand/derive.cpp26
-rw-r--r--src/expand/lang_item.cpp8
-rw-r--r--src/expand/macro_rules.cpp6
-rw-r--r--src/expand/mod.cpp23
-rw-r--r--src/expand/proc_macro.cpp6
-rw-r--r--src/expand/std_prelude.cpp10
-rw-r--r--src/expand/test.cpp6
10 files changed, 59 insertions, 58 deletions
diff --git a/src/expand/cfg.cpp b/src/expand/cfg.cpp
index a2fca312..773a38c4 100644
--- a/src/expand/cfg.cpp
+++ b/src/expand/cfg.cpp
@@ -30,7 +30,7 @@ void Cfg_SetValueCb(::std::string name, ::std::function<bool(const ::std::string
g_cfg_value_fcns.insert( ::std::make_pair(mv$(name), mv$(cb)) );
}
-bool check_cfg(Span sp, const ::AST::MetaItem& mi) {
+bool check_cfg(const Span& sp, const ::AST::Attribute& mi) {
if( mi.has_sub_items() ) {
// Must be `any`/`not`/`all`
@@ -117,7 +117,7 @@ class CCfgHandler:
AttrStage stage() const override { return AttrStage::Pre; }
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate) const override {
DEBUG("#[cfg] crate - " << mi);
// Ignore, as #[cfg] on a crate is handled in expand/mod.cpp
if( check_cfg(sp, mi) ) {
@@ -126,7 +126,7 @@ class CCfgHandler:
crate.m_root_module.items().clear();
}
}
- void handle(const Span& sp, const AST::MetaItem& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
TRACE_FUNCTION_FR("#[cfg] item - " << mi, (i.is_None() ? "Deleted" : ""));
if( check_cfg(sp, mi) ) {
// Leave
@@ -135,7 +135,7 @@ class CCfgHandler:
i = AST::Item::make_None({});
}
}
- void handle(const Span& sp, const AST::MetaItem& mi, ::AST::Crate& crate, ::std::unique_ptr<AST::ExprNode>& expr) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, ::AST::Crate& crate, ::std::unique_ptr<AST::ExprNode>& expr) const override {
DEBUG("#[cfg] expr - " << mi);
if( check_cfg(sp, mi) ) {
// Leave
@@ -144,7 +144,7 @@ class CCfgHandler:
expr.reset();
}
}
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, const AST::Module& mod, AST::ImplDef& impl) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate, const AST::Module& mod, AST::ImplDef& impl) const override {
DEBUG("#[cfg] impl - " << mi);
if( check_cfg(sp, mi) ) {
// Leave
@@ -154,32 +154,32 @@ class CCfgHandler:
}
}
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, ::AST::StructItem& si) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate, ::AST::StructItem& si) const override {
DEBUG("#[cfg] struct item - " << mi);
if( !check_cfg(sp, mi) ) {
si.m_name = "";
}
}
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, ::AST::TupleItem& i) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate, ::AST::TupleItem& i) const override {
DEBUG("#[cfg] tuple item - " << mi);
if( !check_cfg(sp, mi) ) {
i.m_type = ::TypeRef(sp);
}
}
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, ::AST::EnumVariant& i) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate, ::AST::EnumVariant& i) const override {
DEBUG("#[cfg] enum variant - " << mi);
if( !check_cfg(sp, mi) ) {
i.m_name = "";
}
}
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, ::AST::ExprNode_Match_Arm& i) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate, ::AST::ExprNode_Match_Arm& i) const override {
DEBUG("#[cfg] match arm - " << mi);
if( !check_cfg(sp, mi) ) {
i.m_patterns.clear();
}
}
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, ::AST::ExprNode_StructLiteral::Ent& i) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate, ::AST::ExprNode_StructLiteral::Ent& i) const override {
DEBUG("#[cfg] struct lit - " << mi);
if( !check_cfg(sp, mi) ) {
i.value.reset();
diff --git a/src/expand/cfg.hpp b/src/expand/cfg.hpp
index edf17851..7c7785bb 100644
--- a/src/expand/cfg.hpp
+++ b/src/expand/cfg.hpp
@@ -6,4 +6,4 @@
extern void Cfg_SetFlag(::std::string name);
extern void Cfg_SetValue(::std::string name, ::std::string val);
extern void Cfg_SetValueCb(::std::string name, ::std::function<bool(const ::std::string&)> cb);
-extern bool check_cfg(Span sp, const ::AST::MetaItem& mi);
+extern bool check_cfg(const Span& sp, const ::AST::Attribute& mi);
diff --git a/src/expand/crate_tags.cpp b/src/expand/crate_tags.cpp
index e99f1aa2..0e7d8447 100644
--- a/src/expand/crate_tags.cpp
+++ b/src/expand/crate_tags.cpp
@@ -14,7 +14,7 @@ class Decorator_CrateType:
public:
AttrStage stage() const override { return AttrStage::Pre; }
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate) const override {
if( crate.m_crate_type != AST::Crate::Type::Unknown ) {
//ERROR(sp, E0000, "Multiple #![crate_type] attributes");
return ;
@@ -41,7 +41,7 @@ class Decorator_CrateName:
public:
AttrStage stage() const override { return AttrStage::Pre; }
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate) const override {
if( crate.m_crate_name != "" ) {
ERROR(sp, E0000, "Multiple #![crate_name] attributes");
}
@@ -58,7 +58,7 @@ class Decorator_Allocator:
public:
AttrStage stage() const override { return AttrStage::Pre; }
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate) const override {
// TODO: Check for an existing allocator crate
crate.m_lang_items.insert(::std::make_pair( "mrustc-allocator", AST::Path("",{}) ));
}
@@ -69,7 +69,7 @@ class Decorator_PanicRuntime:
public:
AttrStage stage() const override { return AttrStage::Pre; }
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate) const override {
// TODO: Check for an existing panic_runtime crate
crate.m_lang_items.insert(::std::make_pair( "mrustc-panic_runtime", AST::Path("",{}) ));
}
@@ -80,7 +80,7 @@ class Decorator_NeedsPanicRuntime:
public:
AttrStage stage() const override { return AttrStage::Pre; }
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate) const override {
crate.m_lang_items.insert(::std::make_pair( "mrustc-needs_panic_runtime", AST::Path("",{}) ));
}
};
diff --git a/src/expand/derive.cpp b/src/expand/derive.cpp
index 3b25831c..077c4b70 100644
--- a/src/expand/derive.cpp
+++ b/src/expand/derive.cpp
@@ -303,7 +303,7 @@ class Deriver_Debug:
AST::GenericParams params = get_params_with_bounds(sp, p, debug_trait, mv$(types_to_bound));
- AST::Impl rv( AST::ImplDef( sp, AST::MetaItems(), mv$(params), make_spanned(sp, debug_trait), type.clone() ) );
+ AST::Impl rv( AST::ImplDef( AST::AttributeList(), mv$(params), make_spanned(sp, debug_trait), type.clone() ) );
rv.add_function(false, false, "fmt", mv$(fcn));
return mv$(rv);
}
@@ -488,7 +488,7 @@ class Deriver_PartialEq:
AST::GenericParams params = get_params_with_bounds(sp, p, trait_path, mv$(types_to_bound));
- AST::Impl rv( AST::ImplDef( sp, AST::MetaItems(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
+ AST::Impl rv( AST::ImplDef( AST::AttributeList(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
rv.add_function(false, false, "eq", mv$(fcn));
return mv$(rv);
}
@@ -667,7 +667,7 @@ class Deriver_PartialOrd:
AST::GenericParams params = get_params_with_bounds(sp, p, trait_path, mv$(types_to_bound));
- AST::Impl rv( AST::ImplDef( sp, AST::MetaItems(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
+ AST::Impl rv( AST::ImplDef( AST::AttributeList(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
rv.add_function(false, false, "partial_cmp", mv$(fcn));
return mv$(rv);
}
@@ -910,7 +910,7 @@ class Deriver_Eq:
AST::GenericParams params = get_params_with_bounds(sp, p, trait_path, mv$(types_to_bound));
- AST::Impl rv( AST::ImplDef( sp, AST::MetaItems(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
+ AST::Impl rv( AST::ImplDef( AST::AttributeList(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
rv.add_function(false, false, "assert_receiver_is_total_eq", mv$(fcn));
return mv$(rv);
}
@@ -1062,7 +1062,7 @@ class Deriver_Ord:
AST::GenericParams params = get_params_with_bounds(sp, p, trait_path, mv$(types_to_bound));
- AST::Impl rv( AST::ImplDef( sp, AST::MetaItems(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
+ AST::Impl rv( AST::ImplDef( AST::AttributeList(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
rv.add_function(false, false, "cmp", mv$(fcn));
return mv$(rv);
}
@@ -1294,7 +1294,7 @@ class Deriver_Clone:
AST::GenericParams params = get_params_with_bounds(sp, p, trait_path, mv$(types_to_bound));
- AST::Impl rv( AST::ImplDef( sp, AST::MetaItems(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
+ AST::Impl rv( AST::ImplDef( AST::AttributeList(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
rv.add_function(false, false, "clone", mv$(fcn));
return mv$(rv);
}
@@ -1439,7 +1439,7 @@ class Deriver_Copy:
AST::GenericParams params = get_params_with_bounds(sp, p, trait_path, mv$(types_to_bound));
- AST::Impl rv( AST::ImplDef( sp, AST::MetaItems(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
+ AST::Impl rv( AST::ImplDef( AST::AttributeList(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
return mv$(rv);
}
@@ -1486,7 +1486,7 @@ class Deriver_Default:
AST::GenericParams params = get_params_with_bounds(sp, p, trait_path, mv$(types_to_bound));
- AST::Impl rv( AST::ImplDef( sp, AST::MetaItems(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
+ AST::Impl rv( AST::ImplDef( AST::AttributeList(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
rv.add_function(false, false, "default", mv$(fcn));
return mv$(rv);
}
@@ -1573,7 +1573,7 @@ class Deriver_Hash:
AST::GenericParams params = get_params_with_bounds(sp, p, trait_path, mv$(types_to_bound));
- AST::Impl rv( AST::ImplDef( sp, AST::MetaItems(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
+ AST::Impl rv( AST::ImplDef( AST::AttributeList(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
rv.add_function(false, false, "hash", mv$(fcn));
return mv$(rv);
}
@@ -1727,7 +1727,7 @@ class Deriver_RustcEncodable:
AST::GenericParams params = get_params_with_bounds(sp, p, trait_path, mv$(types_to_bound));
- AST::Impl rv( AST::ImplDef( sp, AST::MetaItems(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
+ AST::Impl rv( AST::ImplDef( AST::AttributeList(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
rv.add_function(false, false, "encode", mv$(fcn));
return mv$(rv);
}
@@ -1961,7 +1961,7 @@ class Deriver_RustcDecodable:
AST::GenericParams params = get_params_with_bounds(sp, p, trait_path, mv$(types_to_bound));
- AST::Impl rv( AST::ImplDef( sp, AST::MetaItems(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
+ AST::Impl rv( AST::ImplDef( AST::AttributeList(), mv$(params), make_spanned(sp, trait_path), type.clone() ) );
rv.add_function(false, false, "decode", mv$(fcn));
return mv$(rv);
}
@@ -2185,7 +2185,7 @@ static const Deriver* find_impl(const ::std::string& trait_name)
}
template<typename T>
-static void derive_item(const Span& sp, const AST::Crate& crate, AST::Module& mod, const AST::MetaItem& attr, const AST::Path& path, const T& item)
+static void derive_item(const Span& sp, const AST::Crate& crate, AST::Module& mod, const AST::Attribute& attr, const AST::Path& path, const T& item)
{
if( !attr.has_sub_items() ) {
//ERROR(sp, E0000, "#[derive()] requires a list of known traits to derive");
@@ -2257,7 +2257,7 @@ class Decorator_Derive:
{
public:
AttrStage stage() const override { return AttrStage::Post; }
- void handle(const Span& sp, const AST::MetaItem& attr, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
+ void handle(const Span& sp, const AST::Attribute& attr, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
{
TU_MATCH_DEF(::AST::Item, (i), (e),
(
diff --git a/src/expand/lang_item.cpp b/src/expand/lang_item.cpp
index 53606bea..789ad88e 100644
--- a/src/expand/lang_item.cpp
+++ b/src/expand/lang_item.cpp
@@ -125,7 +125,7 @@ class Decorator_LangItem:
{
public:
AttrStage stage() const override { return AttrStage::Post; }
- void handle(const Span& sp, const AST::MetaItem& attr, AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
+ void handle(const Span& sp, const AST::Attribute& attr, AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
{
TU_MATCH_DEF(::AST::Item, (i), (e),
(
@@ -154,7 +154,7 @@ public:
)
}
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate, const AST::Module& mod, AST::ImplDef& impl) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate, const AST::Module& mod, AST::ImplDef& impl) const override {
const ::std::string& name = mi.string();
if( name == "i8" ) {}
@@ -193,7 +193,7 @@ class Decorator_Main:
{
public:
AttrStage stage() const override { return AttrStage::Post; }
- void handle(const Span& sp, const AST::MetaItem& attr, AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
+ void handle(const Span& sp, const AST::Attribute& attr, AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
{
if( i.is_None() ) {
// Ignore.
@@ -217,7 +217,7 @@ class Decorator_Start:
{
public:
AttrStage stage() const override { return AttrStage::Post; }
- void handle(const Span& sp, const AST::MetaItem& attr, AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
+ void handle(const Span& sp, const AST::Attribute& attr, AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
{
TU_IFLET(::AST::Item, i, Function, e,
auto rv = crate.m_lang_items.insert(::std::make_pair( ::std::string("mrustc-start"), ::AST::Path(path) ));
diff --git a/src/expand/macro_rules.cpp b/src/expand/macro_rules.cpp
index 5b783949..5aa15a46 100644
--- a/src/expand/macro_rules.cpp
+++ b/src/expand/macro_rules.cpp
@@ -41,7 +41,7 @@ class CMacroUseHandler:
{
AttrStage stage() const override { return AttrStage::Post; }
- void handle(const Span& sp, const AST::MetaItem& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
+ void handle(const Span& sp, const AST::Attribute& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
{
TRACE_FUNCTION_F("path=" << path);
@@ -120,7 +120,7 @@ class CMacroExportHandler:
{
AttrStage stage() const override { return AttrStage::Post; }
- void handle(const Span& sp, const AST::MetaItem& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
+ void handle(const Span& sp, const AST::Attribute& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
{
if( i.is_None() ) {
}
@@ -147,7 +147,7 @@ class CMacroReexportHandler:
public ExpandDecorator
{
AttrStage stage() const override { return AttrStage::Post; }
- void handle(const Span& sp, const AST::MetaItem& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
+ void handle(const Span& sp, const AST::Attribute& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
{
if( !i.is_Crate() ) {
ERROR(sp, E0000, "Use of #[macro_reexport] on non-crate - " << i.tag_str());
diff --git a/src/expand/mod.cpp b/src/expand/mod.cpp
index 571d21e2..aa7655e3 100644
--- a/src/expand/mod.cpp
+++ b/src/expand/mod.cpp
@@ -21,7 +21,7 @@ MacroDef* g_macros_list = nullptr;
::std::map< ::std::string, ::std::unique_ptr<ExpandDecorator> > g_decorators;
::std::map< ::std::string, ::std::unique_ptr<ExpandProcMacro> > g_macros;
-void Expand_Attrs(const ::AST::MetaItems& attrs, AttrStage stage, ::std::function<void(const ExpandDecorator& d,const ::AST::MetaItem& a)> f);
+void Expand_Attrs(const ::AST::AttributeList& attrs, AttrStage stage, ::std::function<void(const ExpandDecorator& d,const ::AST::Attribute& a)> f);
void Expand_Mod(::AST::Crate& crate, LList<const AST::Module*> modstack, ::AST::Path modpath, ::AST::Module& mod, unsigned int first_item = 0);
void Expand_Expr(::AST::Crate& crate, LList<const AST::Module*> modstack, AST::Expr& node);
void Expand_Expr(::AST::Crate& crate, LList<const AST::Module*> modstack, ::std::shared_ptr<AST::ExprNode>& node);
@@ -43,12 +43,12 @@ void Register_Synext_Macro_Static(MacroDef* def) {
}
-void ExpandDecorator::unexpected(const Span& sp, const AST::MetaItem& mi, const char* loc_str) const
+void ExpandDecorator::unexpected(const Span& sp, const AST::Attribute& mi, const char* loc_str) const
{
WARNING(sp, W0000, "Unexpected attribute " << mi.name() << " on " << loc_str);
}
-void Expand_Attr(const Span& sp, const ::AST::MetaItem& a, AttrStage stage, ::std::function<void(const Span& sp, const ExpandDecorator& d,const ::AST::MetaItem& a)> f)
+void Expand_Attr(const Span& sp, const ::AST::Attribute& a, AttrStage stage, ::std::function<void(const Span& sp, const ExpandDecorator& d,const ::AST::Attribute& a)> f)
{
for( auto& d : g_decorators ) {
if( d.first == a.name() ) {
@@ -59,29 +59,30 @@ void Expand_Attr(const Span& sp, const ::AST::MetaItem& a, AttrStage stage, ::s
}
}
}
-void Expand_Attrs(/*const */::AST::MetaItems& attrs, AttrStage stage, ::std::function<void(const Span& sp, const ExpandDecorator& d,const ::AST::MetaItem& a)> f)
+void Expand_Attrs(/*const */::AST::AttributeList& attrs, AttrStage stage, ::std::function<void(const Span& sp, const ExpandDecorator& d,const ::AST::Attribute& a)> f)
{
for( auto& a : attrs.m_items )
{
if( a.name() == "cfg_attr" ) {
- if( check_cfg(attrs.m_span, a.items().at(0)) ) {
+ if( check_cfg(a.span(), a.items().at(0)) ) {
+ // Wait? Why move?
auto inner_attr = mv$(a.items().at(1));
- Expand_Attr(attrs.m_span, inner_attr, stage, f);
+ Expand_Attr(inner_attr.span(), inner_attr, stage, f);
a = mv$(inner_attr);
}
else {
}
}
else {
- Expand_Attr(attrs.m_span, a, stage, f);
+ Expand_Attr(a.span(), a, stage, f);
}
}
}
-void Expand_Attrs(::AST::MetaItems& attrs, AttrStage stage, ::AST::Crate& crate, const ::AST::Path& path, ::AST::Module& mod, ::AST::Item& item)
+void Expand_Attrs(::AST::AttributeList& attrs, AttrStage stage, ::AST::Crate& crate, const ::AST::Path& path, ::AST::Module& mod, ::AST::Item& item)
{
Expand_Attrs(attrs, stage, [&](const auto& sp, const auto& d, const auto& a){ if(!item.is_None()) d.handle(sp, a, crate, path, mod, item); });
}
-void Expand_Attrs(::AST::MetaItems& attrs, AttrStage stage, ::AST::Crate& crate, ::AST::Module& mod, ::AST::ImplDef& impl)
+void Expand_Attrs(::AST::AttributeList& attrs, AttrStage stage, ::AST::Crate& crate, ::AST::Module& mod, ::AST::ImplDef& impl)
{
Expand_Attrs(attrs, stage, [&](const auto& sp, const auto& d, const auto& a){ d.handle(sp, a, crate, mod, impl); });
}
@@ -1293,7 +1294,7 @@ void Expand(::AST::Crate& crate)
crate.m_extern_crates.at("std").with_all_macros([&](const auto& name, const auto& mac) {
crate.m_root_module.add_macro_import( name, mac );
});
- crate.m_root_module.add_ext_crate(false, "std", "std", ::AST::MetaItems {});
+ crate.m_root_module.add_ext_crate(false, "std", "std", ::AST::AttributeList {});
break;
case ::AST::Crate::LOAD_CORE:
if( crate.m_prelude_path == AST::Path() )
@@ -1301,7 +1302,7 @@ void Expand(::AST::Crate& crate)
crate.m_extern_crates.at("core").with_all_macros([&](const auto& name, const auto& mac) {
crate.m_root_module.add_macro_import( name, mac );
});
- crate.m_root_module.add_ext_crate(false, "core", "core", ::AST::MetaItems {});
+ crate.m_root_module.add_ext_crate(false, "core", "core", ::AST::AttributeList {});
break;
case ::AST::Crate::LOAD_NONE:
break;
diff --git a/src/expand/proc_macro.cpp b/src/expand/proc_macro.cpp
index d34a91a5..cdd13a42 100644
--- a/src/expand/proc_macro.cpp
+++ b/src/expand/proc_macro.cpp
@@ -35,7 +35,7 @@ class Decorator_ProcMacroDerive:
{
public:
AttrStage stage() const override { return AttrStage::Post; }
- void handle(const Span& sp, const AST::MetaItem& attr, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
+ void handle(const Span& sp, const AST::Attribute& attr, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item& i) const override
{
if( i.is_None() )
return;
@@ -609,7 +609,7 @@ namespace {
TODO(sp, "ExprNode_UniOp");
}
- void visit_attrs(const ::AST::MetaItems& attrs)
+ void visit_attrs(const ::AST::AttributeList& attrs)
{
for(const auto& a : attrs.m_items)
{
@@ -622,7 +622,7 @@ namespace {
}
}
}
- void visit_meta_item(const ::AST::MetaItem& i)
+ void visit_meta_item(const ::AST::Attribute& i)
{
m_pmi.send_ident(i.name().c_str());
if( i.has_noarg() ) {
diff --git a/src/expand/std_prelude.cpp b/src/expand/std_prelude.cpp
index e12a441c..6b81b71e 100644
--- a/src/expand/std_prelude.cpp
+++ b/src/expand/std_prelude.cpp
@@ -8,8 +8,8 @@ class Decorator_NoStd:
{
public:
AttrStage stage() const override { return AttrStage::Pre; }
-
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate) const override {
+
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate) const override {
if( crate.m_load_std != AST::Crate::LOAD_STD && crate.m_load_std != AST::Crate::LOAD_CORE ) {
ERROR(sp, E0000, "Invalid use of #![no_std] with itself or #![no_core]");
}
@@ -22,7 +22,7 @@ class Decorator_NoCore:
public:
AttrStage stage() const override { return AttrStage::Pre; }
- void handle(const Span& sp, const AST::MetaItem& mi, AST::Crate& crate) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, AST::Crate& crate) const override {
if( crate.m_load_std != AST::Crate::LOAD_STD && crate.m_load_std != AST::Crate::LOAD_NONE ) {
ERROR(sp, E0000, "Invalid use of #![no_core] with itself or #![no_std]");
}
@@ -42,7 +42,7 @@ class Decorator_NoPrelude:
public:
AttrStage stage() const override { return AttrStage::Pre; }
- void handle(const Span& sp, const AST::MetaItem& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
if( i.is_Module() ) {
i.as_Module().m_insert_prelude = false;
}
@@ -58,7 +58,7 @@ class Decorator_PreludeImport:
public:
AttrStage stage() const override { return AttrStage::Post; }
- void handle(const Span& sp, const AST::MetaItem& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
if( i.is_Use() ) {
const auto& p = i.as_Use().path;
// TODO: Ensure that this statement is a glob (has a name of "")
diff --git a/src/expand/test.cpp b/src/expand/test.cpp
index 12bfbb7d..9497c692 100644
--- a/src/expand/test.cpp
+++ b/src/expand/test.cpp
@@ -14,7 +14,7 @@ class CTestHandler:
{
AttrStage stage() const override { return AttrStage::Post; }
- void handle(const Span& sp, const AST::MetaItem& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
if( ! i.is_Function() ) {
ERROR(sp, E0000, "#[test] can only be put on functions - found on " << i.tag_str());
}
@@ -42,7 +42,7 @@ class CTestHandler_SP:
{
AttrStage stage() const override { return AttrStage::Pre; }
- void handle(const Span& sp, const AST::MetaItem& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
if( ! i.is_Function() ) {
ERROR(sp, E0000, "#[should_panic] can only be put on functions - found on " << i.tag_str());
}
@@ -75,7 +75,7 @@ class CTestHandler_Ignore:
{
AttrStage stage() const override { return AttrStage::Pre; }
- void handle(const Span& sp, const AST::MetaItem& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
+ void handle(const Span& sp, const AST::Attribute& mi, ::AST::Crate& crate, const AST::Path& path, AST::Module& mod, AST::Item&i) const override {
if( ! i.is_Function() ) {
ERROR(sp, E0000, "#[should_panic] can only be put on functions - found on " << i.tag_str());
}