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.h | |
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.h')
-rw-r--r-- | gcc/rust/resolve/rust-forever-stack.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-forever-stack.h b/gcc/rust/resolve/rust-forever-stack.h index 01371fc..bba5875 100644 --- a/gcc/rust/resolve/rust-forever-stack.h +++ b/gcc/rust/resolve/rust-forever-stack.h @@ -438,6 +438,21 @@ public: tl::expected<NodeId, DuplicateNameError> insert (Identifier name, NodeId id); /** + * Insert a new shadowable definition in the innermost `Rib` in this stack + * + * @param name The name of the definition + * @param id Its NodeId + * + * @return `DuplicateNameError` if that node was already present in the Rib, + * the node's `NodeId` otherwise. + * + * @aborts if there are no `Rib`s inserted in the current map, this function + * aborts the program. + */ + tl::expected<NodeId, DuplicateNameError> insert_shadowable (Identifier name, + NodeId id); + + /** * Insert a new definition at the root of this stack * * @param name The name of the definition |