[gcc r14-7321] gccrs: ast: Add NodeId and clone to RestPattern
Arthur Cohen
cohenarthur@gcc.gnu.org
Tue Jan 16 17:22:27 GMT 2024
https://gcc.gnu.org/g:cc89c429d6fe50544b1282b7ca58a10e524490f4
commit r14-7321-gcc89c429d6fe50544b1282b7ca58a10e524490f4
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date: Wed Mar 1 10:54:29 2023 +0100
gccrs: 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>
Diff:
---
gcc/rust/ast/rust-pattern.h | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/gcc/rust/ast/rust-pattern.h b/gcc/rust/ast/rust-pattern.h
index 8200b805f6b..fbff0e4e50a 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
More information about the Gcc-cvs
mailing list