From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 80CCD385828E; Sun, 5 Mar 2023 11:41:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 80CCD385828E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678016494; bh=x8njPsE3+CMZMdcH8BaYSMG8Em4LP+AD41C2x86TO/8=; h=From:To:Subject:Date:From; b=ak47My4umGL5ghs2drNHw8dHMXrExP1ZW9v6dgntqX71UjCPJ5ujhBDSZmuwD+pWF +VCEDWrdtGjCynueCavWE1y92isIdLDaTA3A4lDiN9ye/ofVjvOPi7xpcrafdelp6t fPohFZLoyHvrfwScstLjs8Pl95fb73cF+JLrN2Ys= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] ast: Add NodeId and clone to RestPattern X-Act-Checkin: gcc X-Git-Author: Pierre-Emmanuel Patry X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: ac375e498312c00c3eebc738e77792f8b39e7d8d X-Git-Newrev: a2ef9ad25a81fc01bfa8c24772ad771cf89ab7ea Message-Id: <20230305114134.80CCD385828E@sourceware.org> Date: Sun, 5 Mar 2023 11:41:34 +0000 (GMT) List-Id: https://gcc.gnu.org/g:a2ef9ad25a81fc01bfa8c24772ad771cf89ab7ea commit a2ef9ad25a81fc01bfa8c24772ad771cf89ab7ea Author: Pierre-Emmanuel Patry Date: Wed Mar 1 10:54:29 2023 +0100 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 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 3d7cbed37c3..0cc84252640 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