// Base array initialisation internal element representation thing (abstract)
// aka ArrayElements
-class ArrayElems
+class ArrayElems : public FullVisitable
{
public:
enum ArrayExprType
/* Base HIR node for a single struct expression field (in struct instance
* creation) - abstract */
-class StructExprField
+class StructExprField : public FullVisitable
{
public:
enum StructExprFieldKind
// A block HIR node
class BlockExpr : public ExprWithBlock, public WithInnerAttrs
{
+ // FIXME this should be private + get/set
public:
std::vector<std::unique_ptr<Stmt> > statements;
std::unique_ptr<Expr> expr;
/* "where" clause item base. Abstract - use LifetimeWhereClauseItem,
* TypeBoundWhereClauseItem */
-class WhereClauseItem
+class WhereClauseItem : public FullVisitable
{
public:
enum ItemType
};
// The path-ish thing referred to in a use declaration - abstract base class
-class UseTree
+class UseTree : public FullVisitable
{
Location locus;
Location get_locus () const { return locus; }
- virtual void accept_vis (HIRFullVisitor &vis) = 0;
-
protected:
// Clone function implementation as pure virtual method
virtual UseTree *clone_use_tree_impl () const = 0;
// Returns whether has path (this should always be true).
bool has_path () const { return !path.is_empty (); }
+ AST::SimplePath get_path () { return path; }
+
+ Identifier get_identifier () const { return identifier; }
+
+ NewBindType get_bind_type () const { return bind_type; }
+
// Returns whether has identifier (or, rather, is allowed to).
bool has_identifier () const { return bind_type == IDENTIFIER; }
Location get_locus () const override final { return locus; }
ItemKind get_item_kind () const override { return ItemKind::UseDeclaration; }
+ std::unique_ptr<UseTree> &get_use_tree () { return use_tree; }
void accept_vis (HIRFullVisitor &vis) override;
void accept_vis (HIRStmtVisitor &vis) override;
void accept_vis (HIRVisItemVisitor &vis) override;
};
// A single field in a struct
+// FIXME can't this be a TupleStruct + field_name?
class StructField
{
public:
Analysis::NodeMapping get_mappings () const { return mappings; }
Location get_locus () { return locus; }
-
+ AST::AttrVec &get_outer_attrs () { return outer_attrs; }
Visibility &get_visibility () { return visibility; }
};
};
// A single field in a tuple
-struct TupleField
+class TupleField
{
private:
// bool has_outer_attributes;
Analysis::NodeMapping get_mappings () const { return mappings; }
+ Visibility &get_visibility () { return visibility; }
+
Location get_locus () const { return locus; }
+ AST::AttrVec &get_outer_attrs () { return outer_attrs; }
std::unique_ptr<HIR::Type> &get_field_type () { return field_type; }
};
};
// Function declaration in traits
-struct TraitFunctionDecl
+class TraitFunctionDecl
{
private:
FunctionQualifiers qualifiers;
// Returns whether function has a where clause.
bool has_where_clause () const { return !where_clause.is_empty (); }
+ WhereClause &get_where_clause () { return where_clause; }
+
bool is_method () const { return !self.is_error (); }
SelfParam &get_self () { return self; }