diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-03-01 10:54:29 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2023-03-01 21:31:47 +0000 |
commit | a2ef9ad25a81fc01bfa8c24772ad771cf89ab7ea (patch) | |
tree | 32b710e919c685989070fa43c5aed6936ce4267c | |
parent | ac375e498312c00c3eebc738e77792f8b39e7d8d (diff) | |
download | gcc-a2ef9ad25a81fc01bfa8c24772ad771cf89ab7ea.zip gcc-a2ef9ad25a81fc01bfa8c24772ad771cf89ab7ea.tar.gz gcc-a2ef9ad25a81fc01bfa8c24772ad771cf89ab7ea.tar.bz2 |
ast: Add NodeId and clone to RestPattern
The RestPattern AST node did not have any NodeId to identify it and
could therefore not be instanciated.
gcc/rust/ChangeLog:
* ast/rust-pattern.h (class RestPattern): Add NodeId as well as
the clone_impl function.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
-rw-r--r-- | gcc/rust/ast/rust-pattern.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/rust/ast/rust-pattern.h b/gcc/rust/ast/rust-pattern.h index 3d7cbed..0cc8425 100644 --- a/gcc/rust/ast/rust-pattern.h +++ b/gcc/rust/ast/rust-pattern.h @@ -194,15 +194,26 @@ protected: class RestPattern : public Pattern { Location locus; + NodeId node_id; public: std::string as_string () const override { return ".."; } - RestPattern (Location locus) : locus (locus) {} + RestPattern (Location locus) + : locus (locus), node_id (Analysis::Mappings::get ()->get_next_node_id ()) + {} Location get_locus () const override final { return locus; } void accept_vis (ASTVisitor &vis) override; + + NodeId get_pattern_node_id () const override final { return node_id; } + +protected: + RestPattern *clone_pattern_impl () const override + { + return new RestPattern (*this); + } }; // Base range pattern bound (lower or upper limit) - abstract |