diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2024-01-15 16:34:36 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-08-01 16:52:26 +0200 |
commit | 16e00f3b14cf5a36624c287cfcded74a38b55212 (patch) | |
tree | b3b82064b22289fcd8488fd658a5858577b0703b /gcc/rust/resolve/rust-forever-stack.hxx | |
parent | f9ad1c29376e06950c3065f574f2df96b3265416 (diff) | |
download | gcc-16e00f3b14cf5a36624c287cfcded74a38b55212.zip gcc-16e00f3b14cf5a36624c287cfcded74a38b55212.tar.gz gcc-16e00f3b14cf5a36624c287cfcded74a38b55212.tar.bz2 |
gccrs: Make globbing definition shadowable by default
Elements from glob use declaration shall be shadowable by default.
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.h: Add a new function prototype to insert
a shadowable definition.
* resolve/rust-forever-stack.hxx: Add the new insert_shadowable
function to insert shadowable definition into the forever stack.
* resolve/rust-name-resolution-context.cc (NameResolutionContext::insert_shadowable):
Likewise with the name resolution context.
* resolve/rust-name-resolution-context.h: Add name resolution context
insert_shadowable member function prototype.
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Insert shadowable definition into the forever stack for glob use
declaration.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/resolve/rust-forever-stack.hxx')
-rw-r--r-- | gcc/rust/resolve/rust-forever-stack.hxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx index a2fdce9..008adff 100644 --- a/gcc/rust/resolve/rust-forever-stack.hxx +++ b/gcc/rust/resolve/rust-forever-stack.hxx @@ -121,6 +121,16 @@ ForeverStack<N>::insert (Identifier name, NodeId node) template <Namespace N> tl::expected<NodeId, DuplicateNameError> +ForeverStack<N>::insert_shadowable (Identifier name, NodeId node) +{ + auto &innermost_rib = peek (); + + return insert_inner (innermost_rib, name.as_string (), + Rib::Definition::Shadowable (node)); +} + +template <Namespace N> +tl::expected<NodeId, DuplicateNameError> ForeverStack<N>::insert_at_root (Identifier name, NodeId node) { auto &root_rib = root.rib; |