]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Improve handling of ConstantItem during name resolution 2.0
authorOwen Avery <powerboat9.gamer@gmail.com>
Thu, 29 Feb 2024 01:19:04 +0000 (20:19 -0500)
committerP-E-P <32375388+P-E-P@users.noreply.github.com>
Thu, 6 Jun 2024 17:50:18 +0000 (17:50 +0000)
gcc/rust/ChangeLog:

* resolve/rust-default-resolver.cc
(DefaultResolver::visit):
Scope with Rib::Kind::ConstantItem instead
of Rib::Kind::Item.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Remove redundancy in override of
ConstantItem visitor.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/resolve/rust-default-resolver.cc
gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc

index d9fe9eef36be1ba73d176e00785c00a60e78bd6d..8138a894900460d136d2f7855619683b9f3e3624 100644 (file)
@@ -487,7 +487,7 @@ DefaultResolver::visit (AST::ConstantItem &item)
       };
 
       // FIXME: Why do we need a Rib here?
-      ctx.scoped (Rib::Kind::Item, item.get_node_id (), expr_vis);
+      ctx.scoped (Rib::Kind::ConstantItem, item.get_node_id (), expr_vis);
     }
 }
 
index b991145c4d4afc5e5ecfd0f47e716bfd86a62dfe..6524a303061b7fb4c12819b12ab8782d237b3246 100644 (file)
@@ -424,10 +424,7 @@ TopLevel::visit (AST::ConstantItem &const_item)
   insert_or_error_out (const_item.get_identifier (), const_item,
                       Namespace::Values);
 
-  auto expr_vis
-    = [this, &const_item] () { const_item.get_expr ().accept_vis (*this); };
-
-  ctx.scoped (Rib::Kind::ConstantItem, const_item.get_node_id (), expr_vis);
+  DefaultResolver::visit (const_item);
 }
 
 bool