diff options
author | Ben Boeckel <mathstuf@gmail.com> | 2021-10-25 10:10:48 -0400 |
---|---|---|
committer | Ben Boeckel <mathstuf@gmail.com> | 2021-10-25 12:45:25 -0400 |
commit | 7661713e0795d37f7ce2d06d44d728b4b47fd2e3 (patch) | |
tree | 7e61d897c8844c6f54807b80ff3de38646fd55d8 /gcc | |
parent | 868d3125d326a6800376411fb6699d984cfa7101 (diff) | |
download | gcc-7661713e0795d37f7ce2d06d44d728b4b47fd2e3.zip gcc-7661713e0795d37f7ce2d06d44d728b4b47fd2e3.tar.gz gcc-7661713e0795d37f7ce2d06d44d728b4b47fd2e3.tar.bz2 |
LifetimeWhereClauseItem: store the location of the item
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/ast/rust-item.h | 7 | ||||
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-item.h | 7 | ||||
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 4 |
3 files changed, 11 insertions, 7 deletions
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h index fb1cb09..d075a57 100644 --- a/gcc/rust/ast/rust-item.h +++ b/gcc/rust/ast/rust-item.h @@ -190,13 +190,14 @@ class LifetimeWhereClauseItem : public WhereClauseItem // LifetimeBounds lifetime_bounds; std::vector<Lifetime> lifetime_bounds; // inlined lifetime bounds - // should this store location info? + Location locus; public: LifetimeWhereClauseItem (Lifetime lifetime, - std::vector<Lifetime> lifetime_bounds) + std::vector<Lifetime> lifetime_bounds, + Location locus) : lifetime (std::move (lifetime)), - lifetime_bounds (std::move (lifetime_bounds)) + lifetime_bounds (std::move (lifetime_bounds)), locus (locus) {} std::string as_string () const override; diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h index 68ba69f..c52870d 100644 --- a/gcc/rust/hir/tree/rust-hir-item.h +++ b/gcc/rust/hir/tree/rust-hir-item.h @@ -165,13 +165,14 @@ class LifetimeWhereClauseItem : public WhereClauseItem // LifetimeBounds lifetime_bounds; std::vector<Lifetime> lifetime_bounds; // inlined lifetime bounds - // should this store location info? + Location locus; public: LifetimeWhereClauseItem (Lifetime lifetime, - std::vector<Lifetime> lifetime_bounds) + std::vector<Lifetime> lifetime_bounds, + Location locus) : lifetime (std::move (lifetime)), - lifetime_bounds (std::move (lifetime_bounds)) + lifetime_bounds (std::move (lifetime_bounds)), locus (locus) {} std::string as_string () const override; diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index c2d3720..14e4e80 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -3579,9 +3579,11 @@ Parser<ManagedTokenSource>::parse_lifetime_where_clause_item () std::vector<AST::Lifetime> lifetime_bounds = parse_lifetime_bounds (); // TODO: have end token passed in? + Location locus = lifetime.get_locus (); + return std::unique_ptr<AST::LifetimeWhereClauseItem> ( new AST::LifetimeWhereClauseItem (std::move (lifetime), - std::move (lifetime_bounds))); + std::move (lifetime_bounds), locus)); } // Parses a type bound where clause item. |