std::vector<Attribute> outer_attrs;
TraitFunctionDecl decl;
std::unique_ptr<BlockExpr> block_expr;
- Location locus;
public:
// Returns whether function has a definition or is just a declaration.
TraitItemFunc (TraitFunctionDecl decl, std::unique_ptr<BlockExpr> block_expr,
std::vector<Attribute> outer_attrs, Location locus)
- : TraitItem (), outer_attrs (std::move (outer_attrs)),
- decl (std::move (decl)), block_expr (std::move (block_expr)),
- locus (locus)
+ : TraitItem (locus), outer_attrs (std::move (outer_attrs)),
+ decl (std::move (decl)), block_expr (std::move (block_expr))
{}
// Copy constructor with clone
TraitItemFunc (TraitItemFunc const &other)
- : outer_attrs (other.outer_attrs), decl (other.decl), locus (other.locus)
+ : TraitItem (other.locus), outer_attrs (other.outer_attrs),
+ decl (other.decl)
{
node_id = other.node_id;
std::string as_string () const override;
- Location get_locus () const { return locus; }
-
void accept_vis (ASTVisitor &vis) override;
// Invalid if trait decl is empty, so base stripping on that.
std::vector<Attribute> outer_attrs;
TraitMethodDecl decl;
std::unique_ptr<BlockExpr> block_expr;
- Location locus;
public:
// Returns whether method has a definition or is just a declaration.
TraitItemMethod (TraitMethodDecl decl, std::unique_ptr<BlockExpr> block_expr,
std::vector<Attribute> outer_attrs, Location locus)
- : TraitItem (), outer_attrs (std::move (outer_attrs)),
- decl (std::move (decl)), block_expr (std::move (block_expr)),
- locus (locus)
+ : TraitItem (locus), outer_attrs (std::move (outer_attrs)),
+ decl (std::move (decl)), block_expr (std::move (block_expr))
{}
// Copy constructor with clone
TraitItemMethod (TraitItemMethod const &other)
- : outer_attrs (other.outer_attrs), decl (other.decl), locus (other.locus)
+ : TraitItem (other.locus), outer_attrs (other.outer_attrs),
+ decl (other.decl)
{
node_id = other.node_id;
std::string as_string () const override;
- Location get_locus () const { return locus; }
-
void accept_vis (ASTVisitor &vis) override;
// Invalid if trait decl is empty, so base stripping on that.
// bool has_expression;
std::unique_ptr<Expr> expr;
- Location locus;
-
public:
// Whether the constant item has an associated expression.
bool has_expression () const { return expr != nullptr; }
TraitItemConst (Identifier name, std::unique_ptr<Type> type,
std::unique_ptr<Expr> expr,
std::vector<Attribute> outer_attrs, Location locus)
- : TraitItem (), outer_attrs (std::move (outer_attrs)),
- name (std::move (name)), type (std::move (type)), expr (std::move (expr)),
- locus (locus)
+ : TraitItem (locus), outer_attrs (std::move (outer_attrs)),
+ name (std::move (name)), type (std::move (type)), expr (std::move (expr))
{}
// Copy constructor with clones
TraitItemConst (TraitItemConst const &other)
- : outer_attrs (other.outer_attrs), name (other.name), locus (other.locus)
+ : TraitItem (other.locus), outer_attrs (other.outer_attrs),
+ name (other.name)
{
node_id = other.node_id;
std::vector<std::unique_ptr<TypeParamBound>>
type_param_bounds; // inlined form
- Location locus;
-
public:
// Returns whether trait item type has type param bounds.
bool has_type_param_bounds () const { return !type_param_bounds.empty (); }
TraitItemType (Identifier name,
std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds,
std::vector<Attribute> outer_attrs, Location locus)
- : TraitItem (), outer_attrs (std::move (outer_attrs)),
- name (std::move (name)),
- type_param_bounds (std::move (type_param_bounds)), locus (locus)
+ : TraitItem (locus), outer_attrs (std::move (outer_attrs)),
+ name (std::move (name)), type_param_bounds (std::move (type_param_bounds))
{}
// Copy constructor with vector clone
TraitItemType (TraitItemType const &other)
- : outer_attrs (other.outer_attrs), name (other.name), locus (other.locus)
+ : TraitItem (other.locus), outer_attrs (other.outer_attrs),
+ name (other.name)
{
node_id = other.node_id;
type_param_bounds.reserve (other.type_param_bounds.size ());
std::string as_string () const override;
- Location get_locus () const { return locus; }
-
void accept_vis (ASTVisitor &vis) override;
// Invalid if name is empty, so base stripping on that.
MacroInvocData invoc_data, std::vector<Attribute> outer_attrs,
Location locus, bool is_semi_coloned,
std::vector<std::unique_ptr<MacroInvocation>> &&pending_eager_invocs)
- : outer_attrs (std::move (outer_attrs)), locus (locus),
+ : TraitItem (locus), outer_attrs (std::move (outer_attrs)), locus (locus),
node_id (Analysis::Mappings::get ()->get_next_node_id ()),
invoc_data (std::move (invoc_data)), is_semi_coloned (is_semi_coloned),
kind (kind), builtin_kind (builtin_kind),
{}
MacroInvocation (const MacroInvocation &other)
- : outer_attrs (other.outer_attrs), locus (other.locus),
- node_id (other.node_id), invoc_data (other.invoc_data),
- is_semi_coloned (other.is_semi_coloned), kind (other.kind),
- builtin_kind (other.builtin_kind)
+ : TraitItem (other.locus), outer_attrs (other.outer_attrs),
+ locus (other.locus), node_id (other.node_id),
+ invoc_data (other.invoc_data), is_semi_coloned (other.is_semi_coloned),
+ kind (other.kind), builtin_kind (other.builtin_kind)
{
if (other.kind == InvocKind::Builtin)
for (auto &pending : other.pending_eager_invocs)