aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-02-28 17:34:31 +0100
committerPhilip Herron <philip.herron@embecosm.com>2023-02-28 22:37:17 +0000
commitc2a3b370a9f42846f7d82512719d4127fa3fca4b (patch)
treee4a71c66ac76dc47c704b63b7d7de8f5423eaaa5 /gcc/rust/resolve
parent41890d20e27d9be91fe5b35d5c85fb6a4ddcd2dd (diff)
downloadgcc-c2a3b370a9f42846f7d82512719d4127fa3fca4b.zip
gcc-c2a3b370a9f42846f7d82512719d4127fa3fca4b.tar.gz
gcc-c2a3b370a9f42846f7d82512719d4127fa3fca4b.tar.bz2
ast: Add RestPattern AST node
Add the RestPattern AST node representing ".." code in some rust context. This commit also provides the different visitors for this node. gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add visitor. * ast/rust-ast-dump.h: Add visitor prototype. * ast/rust-ast-full-decls.h (class RestPattern): Add forward declaration for class RestPattern. * ast/rust-ast-visitor.h: Add visitor prototype. * ast/rust-ast.cc (RestPattern::accept_vis): Add function to accept a foreign visitor. * ast/rust-pattern.h (class RestPattern): Add class RestPattern. * checks/errors/rust-feature-gate.h: Add visitor prototype. * expand/rust-attribute-visitor.cc (AttrVisitor::visit): Add visitor implementation. * expand/rust-attribute-visitor.h: Add visitor prototype. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Add visitor implementation. * hir/rust-ast-lower-base.h: Add visitor prototype. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Add visitor implementation. * resolve/rust-ast-resolve-base.h: Add visitor prototype. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Add visitor implementation. * resolve/rust-early-name-resolver.h: Add visitor prototype. * util/rust-attributes.cc (AttributeChecker::visit): Add visitor implementation. * util/rust-attributes.h: Add visitor prototype. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-base.cc4
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-base.h1
-rw-r--r--gcc/rust/resolve/rust-early-name-resolver.cc4
-rw-r--r--gcc/rust/resolve/rust-early-name-resolver.h1
4 files changed, 10 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-base.cc b/gcc/rust/resolve/rust-ast-resolve-base.cc
index 2f82f91..2667a24 100644
--- a/gcc/rust/resolve/rust-ast-resolve-base.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-base.cc
@@ -519,6 +519,10 @@ ResolverBase::visit (AST::WildcardPattern &)
{}
void
+ResolverBase::visit (AST::RestPattern &)
+{}
+
+void
ResolverBase::visit (AST::RangePatternBoundLiteral &)
{}
diff --git a/gcc/rust/resolve/rust-ast-resolve-base.h b/gcc/rust/resolve/rust-ast-resolve-base.h
index 994f61e9..df70303 100644
--- a/gcc/rust/resolve/rust-ast-resolve-base.h
+++ b/gcc/rust/resolve/rust-ast-resolve-base.h
@@ -158,6 +158,7 @@ public:
void visit (AST::LiteralPattern &);
void visit (AST::IdentifierPattern &);
void visit (AST::WildcardPattern &);
+ void visit (AST::RestPattern &);
void visit (AST::RangePatternBoundLiteral &);
void visit (AST::RangePatternBoundPath &);
diff --git a/gcc/rust/resolve/rust-early-name-resolver.cc b/gcc/rust/resolve/rust-early-name-resolver.cc
index 584d430..10f7626 100644
--- a/gcc/rust/resolve/rust-early-name-resolver.cc
+++ b/gcc/rust/resolve/rust-early-name-resolver.cc
@@ -957,6 +957,10 @@ EarlyNameResolver::visit (AST::WildcardPattern &)
{}
void
+EarlyNameResolver::visit (AST::RestPattern &)
+{}
+
+void
EarlyNameResolver::visit (AST::RangePatternBoundLiteral &)
{}
diff --git a/gcc/rust/resolve/rust-early-name-resolver.h b/gcc/rust/resolve/rust-early-name-resolver.h
index 4f515331..c94a775 100644
--- a/gcc/rust/resolve/rust-early-name-resolver.h
+++ b/gcc/rust/resolve/rust-early-name-resolver.h
@@ -233,6 +233,7 @@ private:
virtual void visit (AST::LiteralPattern &pattern);
virtual void visit (AST::IdentifierPattern &pattern);
virtual void visit (AST::WildcardPattern &pattern);
+ virtual void visit (AST::RestPattern &pattern);
virtual void visit (AST::RangePatternBoundLiteral &bound);
virtual void visit (AST::RangePatternBoundPath &bound);
virtual void visit (AST::RangePatternBoundQualPath &bound);