@@ -322,8 +322,7 @@ Attribute::get_traits_to_derive ()
322
322
}
323
323
break ;
324
324
case AST::AttrInput::TOKEN_TREE:
325
- case AST::AttrInput::LITERAL:
326
- case AST::AttrInput::MACRO:
325
+ case AST::AttrInput::EXPR:
327
326
rust_unreachable ();
328
327
break ;
329
328
}
@@ -3344,9 +3343,9 @@ AttrInputMetaItemContainer::as_string () const
3344
3343
}
3345
3344
3346
3345
std::string
3347
- AttrInputMacro ::as_string () const
3346
+ AttrInputExpr ::as_string () const
3348
3347
{
3349
- return " = " + macro ->as_string ();
3348
+ return " = " + expr ->as_string ();
3350
3349
}
3351
3350
3352
3351
/* Override that calls the function recursively on all items contained within
@@ -4056,14 +4055,14 @@ Token::to_token_stream () const
4056
4055
Attribute
4057
4056
MetaNameValueStr::to_attribute () const
4058
4057
{
4059
- LiteralExpr lit_expr (str, Literal::LitType::STRING,
4060
- PrimitiveCoreType::CORETYPE_UNKNOWN, {} , str_locus);
4058
+ auto lit_expr = std::make_unique<AST::LiteralExpr> (str, Literal::LitType::STRING,
4059
+ PrimitiveCoreType::CORETYPE_UNKNOWN, std::vector<Attribute> () , str_locus);
4061
4060
// FIXME: What location do we put here? Is the literal above supposed to have
4062
4061
// an empty location as well?
4063
4062
// Should MetaNameValueStr keep a location?
4064
4063
return Attribute (SimplePath::from_str (ident.as_string (), ident_locus),
4065
- std::unique_ptr<AttrInputLiteral > (
4066
- new AttrInputLiteral (std::move (lit_expr))));
4064
+ std::unique_ptr<AttrInputExpr > (
4065
+ new AttrInputExpr (std::move (lit_expr))));
4067
4066
}
4068
4067
4069
4068
Attribute
@@ -4129,10 +4128,9 @@ MetaListNameValueStr::to_attribute () const
4129
4128
Attribute
4130
4129
MetaItemPathExpr::to_attribute () const
4131
4130
{
4132
- rust_assert (expr->is_literal ());
4133
- auto &lit = static_cast <LiteralExpr &> (*expr);
4134
- return Attribute (path, std::unique_ptr<AttrInputLiteral> (
4135
- new AttrInputLiteral (lit)));
4131
+ // TODO: should we move instead of clone?
4132
+ return Attribute (path, std::unique_ptr<AttrInputExpr> (
4133
+ new AttrInputExpr (expr->clone_expr ())));
4136
4134
}
4137
4135
4138
4136
std::vector<Attribute>
@@ -4236,19 +4234,6 @@ BlockExpr::normalize_tail_expr ()
4236
4234
}
4237
4235
}
4238
4236
4239
- // needed here because "rust-expr.h" doesn't include "rust-macro.h"
4240
- AttrInputMacro::AttrInputMacro (const AttrInputMacro &oth)
4241
- : macro (oth.macro->clone_macro_invocation_impl ())
4242
- {}
4243
-
4244
- AttrInputMacro &
4245
- AttrInputMacro::operator = (const AttrInputMacro &oth)
4246
- {
4247
- macro = std::unique_ptr<MacroInvocation> (
4248
- oth.macro ->clone_macro_invocation_impl ());
4249
- return *this ;
4250
- }
4251
-
4252
4237
/* Visitor implementations - these are short but inlining can't happen anyway
4253
4238
* due to virtual functions and I didn't want to make the ast header includes
4254
4239
* any longer than they already are. */
@@ -4290,13 +4275,7 @@ LiteralExpr::accept_vis (ASTVisitor &vis)
4290
4275
}
4291
4276
4292
4277
void
4293
- AttrInputLiteral::accept_vis (ASTVisitor &vis)
4294
- {
4295
- vis.visit (*this );
4296
- }
4297
-
4298
- void
4299
- AttrInputMacro::accept_vis (ASTVisitor &vis)
4278
+ AttrInputExpr::accept_vis (ASTVisitor &vis)
4300
4279
{
4301
4280
vis.visit (*this );
4302
4281
}
0 commit comments