Skip to content

Commit 9487aac

Browse files
P-E-Pdkm
authored andcommitted
Add locus getters
gcc/rust/ChangeLog: * ast/rust-expr.h: Add getter to locus field. * ast/rust-pattern.h (tokenid_to_rangekind): Likewise. * hir/tree/rust-hir-item.h: Likewise. * hir/tree/rust-hir-visibility.h: Likewise. Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
1 parent 701552c commit 9487aac

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

gcc/rust/ast/rust-expr.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,8 @@ class ArrayElemsValues : public ArrayElems
11921192

11931193
std::string as_string () const override;
11941194

1195+
location_t get_locus () const { return locus; }
1196+
11951197
void accept_vis (ASTVisitor &vis) override;
11961198

11971199
// TODO: this mutable getter seems really dodgy. Think up better way.
@@ -1248,6 +1250,8 @@ class ArrayElemsCopied : public ArrayElems
12481250

12491251
std::string as_string () const override;
12501252

1253+
location_t get_locus () const { return locus; }
1254+
12511255
void accept_vis (ASTVisitor &vis) override;
12521256

12531257
// TODO: is this better? Or is a "vis_block" better?
@@ -1777,6 +1781,8 @@ struct StructBase
17771781

17781782
std::string as_string () const;
17791783

1784+
location_t get_locus () const { return locus; }
1785+
17801786
// TODO: is this better? Or is a "vis_block" better?
17811787
Expr &get_base_struct ()
17821788
{

gcc/rust/ast/rust-pattern.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ class StructPattern : public Pattern
948948
* is empty). */
949949
bool has_struct_pattern_elems () const { return !elems.is_empty (); }
950950

951-
location_t get_locus () const override { return path.get_locus (); }
951+
location_t get_locus () const override { return locus; }
952952

953953
void accept_vis (ASTVisitor &vis) override;
954954

gcc/rust/hir/tree/rust-hir-item.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ class LifetimeWhereClauseItem : public WhereClauseItem
209209

210210
std::string as_string () const override;
211211

212+
location_t get_locus () const { return locus; }
213+
212214
void accept_vis (HIRFullVisitor &vis) override;
213215

214216
Lifetime &get_lifetime () { return lifetime; }

gcc/rust/hir/tree/rust-hir-visibility.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ struct Visibility
7373
}
7474

7575
std::string as_string () const;
76+
77+
location_t get_locus () const { return locus; }
7678
};
7779
} // namespace HIR
7880
} // namespace Rust

0 commit comments

Comments
 (0)