public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] ast: Add RangePatternBoundType and helpers
@ 2022-06-08 12:46 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:46 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:c31d0c5f78f038baa48cb68f26ce84ed31ce3732
commit c31d0c5f78f038baa48cb68f26ce84ed31ce3732
Author: David Faust <david.faust@oracle.com>
Date: Thu May 12 15:46:43 2022 -0700
ast: Add RangePatternBoundType and helpers
Diff:
---
gcc/rust/ast/rust-pattern.h | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/gcc/rust/ast/rust-pattern.h b/gcc/rust/ast/rust-pattern.h
index a3193f79584..247af5dbe05 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 */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 12:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:46 [gcc/devel/rust/master] ast: Add RangePatternBoundType and helpers Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).