diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2024-11-11 16:37:38 -0500 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2024-11-14 16:33:55 +0000 |
commit | eda3bfdd8296494f32d2598d59c9276f30b84400 (patch) | |
tree | bab80d320e60a330515251cfe948780e0431a6c0 /gcc | |
parent | 680ad4625564f5f0ecf84a281e7b88c677421cbd (diff) | |
download | gcc-eda3bfdd8296494f32d2598d59c9276f30b84400.zip gcc-eda3bfdd8296494f32d2598d59c9276f30b84400.tar.gz gcc-eda3bfdd8296494f32d2598d59c9276f30b84400.tar.bz2 |
Push ribs by kind rather than by value
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.h
(ForeverStack::push): Accept argument of type Rib::Kind rather
than Rib.
* resolve/rust-forever-stack.hxx
(ForeverStack::push): Likewise.
* resolve/rust-name-resolution-context.cc
(NameResolutionContext::scoped): Likewise.
* resolve/rust-name-resolution-context.h
(NameResolutionContext::scoped): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/resolve/rust-forever-stack.h | 2 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-forever-stack.hxx | 5 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-name-resolution-context.cc | 15 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-name-resolution-context.h | 9 |
4 files changed, 17 insertions, 14 deletions
diff --git a/gcc/rust/resolve/rust-forever-stack.h b/gcc/rust/resolve/rust-forever-stack.h index b6062d4..623e256 100644 --- a/gcc/rust/resolve/rust-forever-stack.h +++ b/gcc/rust/resolve/rust-forever-stack.h @@ -416,7 +416,7 @@ public: * @param path An optional path if the Rib was created due to a "named" * lexical scope, like a module's. */ - void push (Rib rib, NodeId id, tl::optional<Identifier> path = {}); + void push (Rib::Kind rib_kind, NodeId id, tl::optional<Identifier> path = {}); /** * Pop the innermost Rib from the stack diff --git a/gcc/rust/resolve/rust-forever-stack.hxx b/gcc/rust/resolve/rust-forever-stack.hxx index 45f89d5..d49488e 100644 --- a/gcc/rust/resolve/rust-forever-stack.hxx +++ b/gcc/rust/resolve/rust-forever-stack.hxx @@ -52,9 +52,10 @@ ForeverStack<N>::Node::insert_child (Link link, Node child) template <Namespace N> void -ForeverStack<N>::push (Rib rib, NodeId id, tl::optional<Identifier> path) +ForeverStack<N>::push (Rib::Kind rib_kind, NodeId id, + tl::optional<Identifier> path) { - push_inner (rib, Link (id, path)); + push_inner (rib_kind, Link (id, path)); } template <Namespace N> diff --git a/gcc/rust/resolve/rust-name-resolution-context.cc b/gcc/rust/resolve/rust-name-resolution-context.cc index 05c392d..1a70cd0 100644 --- a/gcc/rust/resolve/rust-name-resolution-context.cc +++ b/gcc/rust/resolve/rust-name-resolution-context.cc @@ -103,13 +103,13 @@ NameResolutionContext::lookup (NodeId usage) const } void -NameResolutionContext::scoped (Rib rib, NodeId id, +NameResolutionContext::scoped (Rib::Kind rib_kind, NodeId id, std::function<void (void)> lambda, tl::optional<Identifier> path) { - values.push (rib, id, path); - types.push (rib, id, path); - macros.push (rib, id, path); + values.push (rib_kind, id, path); + types.push (rib_kind, id, path); + macros.push (rib_kind, id, path); // labels.push (rib, id); lambda (); @@ -121,17 +121,18 @@ NameResolutionContext::scoped (Rib rib, NodeId id, } void -NameResolutionContext::scoped (Rib rib, Namespace ns, NodeId scope_id, +NameResolutionContext::scoped (Rib::Kind rib_kind, Namespace ns, + NodeId scope_id, std::function<void (void)> lambda, tl::optional<Identifier> path) { switch (ns) { case Namespace::Values: - values.push (rib, scope_id, path); + values.push (rib_kind, scope_id, path); break; case Namespace::Types: - types.push (rib, scope_id, path); + types.push (rib_kind, scope_id, path); break; case Namespace::Labels: case Namespace::Macros: diff --git a/gcc/rust/resolve/rust-name-resolution-context.h b/gcc/rust/resolve/rust-name-resolution-context.h index 13acef3..44d7da7 100644 --- a/gcc/rust/resolve/rust-name-resolution-context.h +++ b/gcc/rust/resolve/rust-name-resolution-context.h @@ -185,8 +185,8 @@ public: * function. This variant of the function enters a new scope in *all* * namespaces, while the second variant enters a scope in *one* namespace. * - * @param rib New `Rib` to create when entering this scope. A function `Rib`, - * or an item `Rib`... etc + * @param rib_kind New `Rib` to create when entering this scope. A function + * `Rib`, or an item `Rib`... etc * @param scope_id node ID of the scope we are entering, e.g the block's * `NodeId`. * @param lambda Function to run within that scope @@ -196,9 +196,10 @@ public: */ // FIXME: Do we want to handle something in particular for expected within the // scoped lambda? - void scoped (Rib rib, NodeId scope_id, std::function<void (void)> lambda, + void scoped (Rib::Kind rib_kind, NodeId scope_id, + std::function<void (void)> lambda, tl::optional<Identifier> path = {}); - void scoped (Rib rib, Namespace ns, NodeId scope_id, + void scoped (Rib::Kind rib_kind, Namespace ns, NodeId scope_id, std::function<void (void)> lambda, tl::optional<Identifier> path = {}); |