diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-06-14 13:20:45 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-06-14 13:27:36 +0200 |
commit | b9013bda082602ecdc6519009fe82c8f17d2cc4d (patch) | |
tree | 5351b2bed1eb0c95a4d421a658afed630da40bb0 /gcc/rust | |
parent | 2fe0a4da436b928900220c84c24fd5955df58dae (diff) | |
download | gcc-b9013bda082602ecdc6519009fe82c8f17d2cc4d.zip gcc-b9013bda082602ecdc6519009fe82c8f17d2cc4d.tar.gz gcc-b9013bda082602ecdc6519009fe82c8f17d2cc4d.tar.bz2 |
ast: Add get_kind() virtual function for GenericParam class
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/ast/rust-ast.h | 11 | ||||
-rw-r--r-- | gcc/rust/ast/rust-item.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index 8f5657f..2d7d31a 100644 --- a/gcc/rust/ast/rust-ast.h +++ b/gcc/rust/ast/rust-ast.h @@ -1255,6 +1255,13 @@ protected: class GenericParam { public: + enum class Kind + { + Lifetime, + Type, + Const, + }; + virtual ~GenericParam () {} // Unique pointer custom clone function @@ -1269,6 +1276,8 @@ public: virtual Location get_locus () const = 0; + virtual Kind get_kind () const = 0; + NodeId get_node_id () { return node_id; } protected: @@ -1322,6 +1331,8 @@ public: Location get_locus () const override final { return locus; } + Kind get_kind () const override final { return Kind::Lifetime; } + protected: /* Use covariance to implement clone function as returning this object rather * than base */ diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h index 6d953fb..94ffffb 100644 --- a/gcc/rust/ast/rust-item.h +++ b/gcc/rust/ast/rust-item.h @@ -132,6 +132,8 @@ public: Location get_locus () const override final { return locus; } + Kind get_kind () const override final { return Kind::Type; } + void accept_vis (ASTVisitor &vis) override; // TODO: is this better? Or is a "vis_block" better? |