diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-06-28 11:30:57 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:49:32 +0100 |
commit | ac88cb00f73e7d3d3dbeb210b7e9e9d129b69952 (patch) | |
tree | 62b6bdfb26cd70b0866871261aa082a035e54d71 | |
parent | b8ce0e28a0114e8a253ab205189f7cb159218a46 (diff) | |
download | gcc-ac88cb00f73e7d3d3dbeb210b7e9e9d129b69952.zip gcc-ac88cb00f73e7d3d3dbeb210b7e9e9d129b69952.tar.gz gcc-ac88cb00f73e7d3d3dbeb210b7e9e9d129b69952.tar.bz2 |
gccrs: collector: Fix method self parameter
Fix visitor for self parameter in methods.
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix self
param output.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
-rw-r--r-- | gcc/rust/ast/rust-ast-collector.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/rust/ast/rust-ast-collector.cc b/gcc/rust/ast/rust-ast-collector.cc index 7bf827e..04c0397 100644 --- a/gcc/rust/ast/rust-ast-collector.cc +++ b/gcc/rust/ast/rust-ast-collector.cc @@ -1600,7 +1600,7 @@ TokenCollector::visit (Method &method) push (Rust::Token::make_identifier (Location (), std::move (method_name))); push (Rust::Token::make (LEFT_PAREN, Location ())); - push (Rust::Token::make (SELF, Location ())); + visit (method.get_self_param ()); if (!method.get_function_params ().empty ()) { push (Rust::Token::make (COMMA, Location ())); @@ -2028,20 +2028,21 @@ TokenCollector::visit (SelfParam ¶m) { if (param.get_has_ref ()) { - push (Rust::Token::make (AMP, param.get_locus ())); + push (Rust::Token::make (AMP, Location ())); if (param.has_lifetime ()) { auto lifetime = param.get_lifetime (); visit (lifetime); } + if (param.get_is_mut ()) + push (Rust::Token::make (MUT, Location ())); } - - if (param.get_is_mut ()) + push (Rust::Token::make (SELF, Location ())); + if (param.has_type ()) { - push (Rust::Token::make (MUT, Location ())); + push (Rust::Token::make (COLON, Location ())); + visit (param.get_type ()); } - - push (Rust::Token::make (SELF, Location ())); } void |