aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-04-20 18:03:15 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-04-20 18:03:15 +0100
commit4eaec8530371eb736717ec02daad6c252332c159 (patch)
treef77d68b9dbaa49641ecda3338033e227e84fab8e
parent03ec66cf1162f139ba873e5d8237a1dfad989937 (diff)
downloadgcc-4eaec8530371eb736717ec02daad6c252332c159.zip
gcc-4eaec8530371eb736717ec02daad6c252332c159.tar.gz
gcc-4eaec8530371eb736717ec02daad6c252332c159.tar.bz2
Add AST::TuplePatternItems::TuplePatternItemType to differentiate between them
-rw-r--r--gcc/rust/ast/rust-pattern.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-pattern.h b/gcc/rust/ast/rust-pattern.h
index 62456e8..a3193f7 100644
--- a/gcc/rust/ast/rust-pattern.h
+++ b/gcc/rust/ast/rust-pattern.h
@@ -1135,6 +1135,12 @@ protected:
class TuplePatternItems
{
public:
+ enum TuplePatternItemType
+ {
+ MULTIPLE,
+ RANGED,
+ };
+
virtual ~TuplePatternItems () {}
// TODO: should this store location data?
@@ -1150,6 +1156,8 @@ public:
virtual void accept_vis (ASTVisitor &vis) = 0;
+ virtual TuplePatternItemType get_pattern_type () const = 0;
+
protected:
// pure virtual clone implementation
virtual TuplePatternItems *clone_tuple_pattern_items_impl () const = 0;
@@ -1234,6 +1242,11 @@ public:
return patterns;
}
+ TuplePatternItemType get_pattern_type () const override
+ {
+ return TuplePatternItemType::MULTIPLE;
+ }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -1312,6 +1325,11 @@ public:
return upper_patterns;
}
+ TuplePatternItemType get_pattern_type () const override
+ {
+ return TuplePatternItemType::RANGED;
+ }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */