From c1ccc7c098dafac076862c25dff6e059f616b31a Mon Sep 17 00:00:00 2001 From: 0xn4utilus Date: Sun, 25 Feb 2024 06:20:51 +0530 Subject: 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 --- gcc/rust/ast/rust-ast.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gcc/rust/ast/rust-ast.h') 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 clone_pattern () const { return std::unique_ptr (clone_pattern_impl ()); } + virtual Kind get_pattern_kind () = 0; + // possible virtual methods: is_refutable() virtual ~Pattern () {} -- cgit v1.1