diff options
author | 0xn4utilus <gyanendrabanjare8@gmail.com> | 2024-02-25 06:20:51 +0530 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-08-01 13:12:15 +0200 |
commit | c1ccc7c098dafac076862c25dff6e059f616b31a (patch) | |
tree | 955b55059851ce83c3f1331684588d4c49451c8d /gcc/rust/ast/rust-ast.h | |
parent | 709db9bb630dd9bc01248414971ab4be82fc22b2 (diff) | |
download | gcc-c1ccc7c098dafac076862c25dff6e059f616b31a.zip gcc-c1ccc7c098dafac076862c25dff6e059f616b31a.tar.gz gcc-c1ccc7c098dafac076862c25dff6e059f616b31a.tar.bz2 |
gccrs: 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-ast.h')
-rw-r--r-- | gcc/rust/ast/rust-ast.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index 92faaf2..edf726b 100644 --- a/gcc/rust/ast/rust-ast.h +++ b/gcc/rust/ast/rust-ast.h @@ -1360,12 +1360,32 @@ protected: class Pattern : public Visitable { public: + enum class Kind + { + Literal, + Identifier, + Wildcard, + Rest, + Range, + Reference, + Struct, + TupleStruct, + Tuple, + Grouped, + Slice, + Alt, + Path, + MacroInvocation, + }; + // Unique pointer custom clone function std::unique_ptr<Pattern> clone_pattern () const { return std::unique_ptr<Pattern> (clone_pattern_impl ()); } + virtual Kind get_pattern_kind () = 0; + // possible virtual methods: is_refutable() virtual ~Pattern () {} |