aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-pattern.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/ast/rust-pattern.h')
-rw-r--r--gcc/rust/ast/rust-pattern.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-pattern.h b/gcc/rust/ast/rust-pattern.h
index a3193f7..247af5d 100644
--- a/gcc/rust/ast/rust-pattern.h
+++ b/gcc/rust/ast/rust-pattern.h
@@ -195,6 +195,13 @@ protected:
class RangePatternBound
{
public:
+ enum RangePatternBoundType
+ {
+ LITERAL,
+ PATH,
+ QUALPATH
+ };
+
virtual ~RangePatternBound () {}
// Unique pointer custom clone function
@@ -208,6 +215,8 @@ public:
virtual void accept_vis (ASTVisitor &vis) = 0;
+ virtual RangePatternBoundType get_bound_type () const = 0;
+
protected:
// pure virtual as RangePatternBound is abstract
virtual RangePatternBound *clone_range_pattern_bound_impl () const = 0;
@@ -234,10 +243,19 @@ public:
std::string as_string () const override;
+ Literal get_literal () const { return literal; }
+
+ bool get_has_minus () const { return has_minus; }
+
Location get_locus () const { return locus; }
void accept_vis (ASTVisitor &vis) override;
+ RangePatternBoundType get_bound_type () const override
+ {
+ return RangePatternBoundType::LITERAL;
+ }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -268,6 +286,11 @@ public:
PathInExpression &get_path () { return path; }
const PathInExpression &get_path () const { return path; }
+ RangePatternBoundType get_bound_type () const override
+ {
+ return RangePatternBoundType::PATH;
+ }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -300,6 +323,11 @@ public:
QualifiedPathInExpression &get_qualified_path () { return path; }
const QualifiedPathInExpression &get_qualified_path () const { return path; }
+ RangePatternBoundType get_bound_type () const override
+ {
+ return RangePatternBoundType::QUALPATH;
+ }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */