]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Resolve SelfParam in name resolution 2.0
authorOwen Avery <powerboat9.gamer@gmail.com>
Fri, 4 Oct 2024 16:56:16 +0000 (12:56 -0400)
committerP-E-P <32375388+P-E-P@users.noreply.github.com>
Tue, 29 Oct 2024 10:20:27 +0000 (10:20 +0000)
gcc/rust/ChangeLog:

* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Handle SelfParam.
* resolve/rust-late-name-resolver-2.0.h
(Late::visit): Likewise.

gcc/testsuite/ChangeLog:

* rust/compile/nr2/exclude: Remove entries.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/resolve/rust-late-name-resolver-2.0.cc
gcc/rust/resolve/rust-late-name-resolver-2.0.h
gcc/testsuite/rust/compile/nr2/exclude

index b85b6bc619cf5d966fce70e41de1465a8e6bde6f..8319a9fe311a030ba5701b1b983c9d463ba91601 100644 (file)
@@ -164,6 +164,18 @@ Late::visit (AST::IdentifierPattern &identifier)
                                              identifier.get_node_id ());
 }
 
+void
+Late::visit (AST::SelfParam &param)
+{
+  // handle similar to AST::IdentifierPattern
+
+  DefaultResolver::visit (param);
+  // FIXME: this location should be a bit off
+  // ex: would point to the begining of "mut self" instead of the "self"
+  std::ignore = ctx.values.insert (Identifier ("self", param.get_locus ()),
+                                  param.get_node_id ());
+}
+
 void
 Late::visit (AST::IdentifierExpr &expr)
 {
index 1cdf2ec3f60d203b8e6f04a817f99d09345e03dc..81c3a046bf4fb008ea1dd05c173ca89131230cf9 100644 (file)
@@ -41,6 +41,7 @@ public:
   // TODO: Do we need this?
   // void visit (AST::Method &) override;
   void visit (AST::IdentifierPattern &) override;
+  void visit (AST::SelfParam &) override;
 
   // resolutions
   void visit (AST::IdentifierExpr &) override;
index f4304dae1d857633f6b8e4cb698aaab421daacca..b4799edd4f5baa1ac3515c6bb89ac7ed7d47d647 100644 (file)
@@ -34,7 +34,6 @@ derive_macro6.rs
 expected_type_args2.rs
 expected_type_args3.rs
 feature_rust_attri0.rs
-feature_rust_attri1.rs
 for_lifetimes.rs
 format_args_basic_expansion.rs
 generic-default1.rs
@@ -54,13 +53,11 @@ infer-crate-name.rs
 issue-1019.rs
 issue-1031.rs
 issue-1034.rs
-issue-1128.rs
 issue-1129-2.rs
 issue-1130.rs
 issue-1165.rs
 issue-1173.rs
 issue-1235.rs
-issue-1237.rs
 issue-1272.rs
 issue-1289.rs
 issue-1447.rs
@@ -167,7 +164,6 @@ redef_error2.rs
 redef_error4.rs
 redef_error5.rs
 redef_error6.rs
-rustc_attr1.rs
 self-path1.rs
 self-path2.rs
 sizeof-stray-infer-var-bug.rs