aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-pattern.h
diff options
context:
space:
mode:
author0xn4utilus <gyanendrabanjare8@gmail.com>2024-02-25 06:20:51 +0530
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2024-03-05 15:08:36 +0000
commit1c467c0a8642d462e045975b0f4c2e667be06ca2 (patch)
treeba9fb3bc778e994c3f9bc7d09ed580acbd5a24bc /gcc/rust/ast/rust-pattern.h
parent48add29a63c464ca27623b41a5d2841ca384e775 (diff)
downloadgcc-1c467c0a8642d462e045975b0f4c2e667be06ca2.zip
gcc-1c467c0a8642d462e045975b0f4c2e667be06ca2.tar.gz
gcc-1c467c0a8642d462e045975b0f4c2e667be06ca2.tar.bz2
Add get_pattern_kind to Pattern
gcc/rust/ChangeLog: * ast/rust-ast.h: Add Kind Enum to Pattern. * ast/rust-macro.h: Add get_pattern_kind(). * ast/rust-path.h: Likewise. * ast/rust-pattern.h: Likewise. Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
Diffstat (limited to 'gcc/rust/ast/rust-pattern.h')
-rw-r--r--gcc/rust/ast/rust-pattern.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-pattern.h b/gcc/rust/ast/rust-pattern.h
index 96f0935..365f3b7 100644
--- a/gcc/rust/ast/rust-pattern.h
+++ b/gcc/rust/ast/rust-pattern.h
@@ -55,6 +55,8 @@ public:
const Literal &get_literal () const { return lit; }
+ Pattern::Kind get_pattern_kind () override { return Pattern::Kind::Literal; }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -149,6 +151,11 @@ public:
NodeId get_node_id () const override { return node_id; }
+ Pattern::Kind get_pattern_kind () override
+ {
+ return Pattern::Kind::Identifier;
+ }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -177,6 +184,8 @@ public:
NodeId get_node_id () const override { return node_id; }
+ Pattern::Kind get_pattern_kind () override { return Pattern::Kind::Wildcard; }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -204,6 +213,8 @@ public:
NodeId get_node_id () const override final { return node_id; }
+ Pattern::Kind get_pattern_kind () override { return Pattern::Kind::Rest; }
+
protected:
RestPattern *clone_pattern_impl () const override
{
@@ -431,6 +442,8 @@ public:
NodeId get_node_id () const override { return node_id; }
+ Pattern::Kind get_pattern_kind () override { return Pattern::Kind::Range; }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -499,6 +512,11 @@ public:
NodeId get_node_id () const override { return node_id; }
+ Pattern::Kind get_pattern_kind () override
+ {
+ return Pattern::Kind::Reference;
+ }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -934,6 +952,8 @@ public:
NodeId get_node_id () const override { return node_id; }
+ Pattern::Kind get_pattern_kind () override { return Pattern::Kind::Struct; }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -1174,6 +1194,11 @@ public:
NodeId get_node_id () const override { return node_id; }
+ Pattern::Kind get_pattern_kind () override
+ {
+ return Pattern::Kind::TupleStruct;
+ }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -1411,6 +1436,8 @@ public:
NodeId get_node_id () const override { return node_id; }
+ Pattern::Kind get_pattern_kind () override { return Pattern::Kind::Tuple; }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -1471,6 +1498,8 @@ public:
NodeId get_node_id () const override { return node_id; }
+ Pattern::Kind get_pattern_kind () override { return Pattern::Kind::Grouped; }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -1535,6 +1564,8 @@ public:
NodeId get_node_id () const override { return node_id; }
+ Pattern::Kind get_pattern_kind () override { return Pattern::Kind::Slice; }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -1600,6 +1631,8 @@ public:
NodeId get_node_id () const override { return node_id; }
+ Pattern::Kind get_pattern_kind () override { return Pattern::Kind::Alt; }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */