aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-path.h
diff options
context:
space:
mode:
authorSimplyTheOther <simplytheother@gmail.com>2021-02-02 13:19:26 +0800
committerSimplyTheOther <simplytheother@gmail.com>2021-02-02 15:55:58 +0800
commit3a0c8ca2156038b726e2689e9b46be4d8c40c55f (patch)
tree3c5e0391cd9ba3a2336a0692f0bc7980469dc165 /gcc/rust/ast/rust-path.h
parentb3a39d99c1d6f45890dbac33a9d17c8dd464654e (diff)
downloadgcc-3a0c8ca2156038b726e2689e9b46be4d8c40c55f.zip
gcc-3a0c8ca2156038b726e2689e9b46be4d8c40c55f.tar.gz
gcc-3a0c8ca2156038b726e2689e9b46be4d8c40c55f.tar.bz2
Cleanup of AST - moved outer_attrs to child classes
Fixed compile errors Fixed more compile errors
Diffstat (limited to 'gcc/rust/ast/rust-path.h')
-rw-r--r--gcc/rust/ast/rust-path.h35
1 files changed, 22 insertions, 13 deletions
diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h
index 2b7c973..b30dffc 100644
--- a/gcc/rust/ast/rust-path.h
+++ b/gcc/rust/ast/rust-path.h
@@ -311,9 +311,9 @@ public:
* arguments) */
class PathInExpression : public PathPattern, public PathExpr
{
+ std::vector<Attribute> outer_attrs;
bool has_opening_scope_resolution;
Location locus;
-
NodeId _node_id;
public:
@@ -321,12 +321,10 @@ public:
// Constructor
PathInExpression (std::vector<PathExprSegment> path_segments,
- Location locus = Location (),
- bool has_opening_scope_resolution = false,
- std::vector<Attribute> outer_attrs
- = std::vector<Attribute> ())
+ std::vector<Attribute> outer_attrs, Location locus,
+ bool has_opening_scope_resolution = false)
: PathPattern (std::move (path_segments)),
- PathExpr (std::move (outer_attrs)),
+ outer_attrs (std::move (outer_attrs)),
has_opening_scope_resolution (has_opening_scope_resolution),
locus (locus), _node_id (Analysis::Mappings::get ()->get_next_node_id ())
{}
@@ -334,7 +332,7 @@ public:
// Creates an error state path in expression.
static PathInExpression create_error ()
{
- return PathInExpression (std::vector<PathExprSegment> ());
+ return PathInExpression ({}, {}, Location ());
}
// Returns whether path in expression is in an error state.
@@ -360,10 +358,16 @@ public:
// Invalid if path is empty (error state), so base stripping on that.
void mark_for_strip () override { remove_all_segments (); }
bool is_marked_for_strip () const override { return is_error (); }
- bool opening_scope_resolution () { return has_opening_scope_resolution; }
+
+ bool opening_scope_resolution () const { return has_opening_scope_resolution; }
NodeId get_node_id () const override { return _node_id; }
+ const std::vector<Attribute> &get_outer_attrs () const { return outer_attrs; }
+ std::vector<Attribute> &get_outer_attrs () { return outer_attrs; }
+
+ void set_outer_attrs (std::vector<Attribute> new_attrs) override { outer_attrs = std::move (new_attrs); }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -835,6 +839,7 @@ public:
* allows specifying trait functions) */
class QualifiedPathInExpression : public PathPattern, public PathExpr
{
+ std::vector<Attribute> outer_attrs;
QualifiedPathType path_type;
Location locus;
@@ -843,11 +848,10 @@ public:
QualifiedPathInExpression (QualifiedPathType qual_path_type,
std::vector<PathExprSegment> path_segments,
- Location locus = Location (),
- std::vector<Attribute> outer_attrs
- = std::vector<Attribute> ())
+ std::vector<Attribute> outer_attrs,
+ Location locus)
: PathPattern (std::move (path_segments)),
- PathExpr (std::move (outer_attrs)),
+ outer_attrs (std::move (outer_attrs)),
path_type (std::move (qual_path_type)), locus (locus)
{}
@@ -861,7 +865,7 @@ public:
static QualifiedPathInExpression create_error ()
{
return QualifiedPathInExpression (QualifiedPathType::create_error (),
- std::vector<PathExprSegment> ());
+ {}, {}, Location ());
}
Location get_locus () const { return locus; }
@@ -883,6 +887,11 @@ public:
return path_type;
}
+ const std::vector<Attribute> &get_outer_attrs () const { return outer_attrs; }
+ std::vector<Attribute> &get_outer_attrs () { return outer_attrs; }
+
+ void set_outer_attrs (std::vector<Attribute> new_attrs) override { outer_attrs = std::move (new_attrs); }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */