diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-10-25 16:51:31 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 19:13:11 +0100 |
commit | 863174590a30970be903286ac34a7b3db1be179f (patch) | |
tree | 2668e576fe10411b83b891a418b2379b56520b85 | |
parent | cb9ecb5596e9ca25a63e3cac264d1304de7f573a (diff) | |
download | gcc-863174590a30970be903286ac34a7b3db1be179f.zip gcc-863174590a30970be903286ac34a7b3db1be179f.tar.gz gcc-863174590a30970be903286ac34a7b3db1be179f.tar.bz2 |
gccrs: Small fix to the ast collector visitor
The parameter type was used instead of the default value.
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Check for presence
of a type and use the default value instead of the type.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
-rw-r--r-- | gcc/rust/ast/rust-ast-collector.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/rust/ast/rust-ast-collector.cc b/gcc/rust/ast/rust-ast-collector.cc index dbc3ef2..71cc098 100644 --- a/gcc/rust/ast/rust-ast-collector.cc +++ b/gcc/rust/ast/rust-ast-collector.cc @@ -534,11 +534,12 @@ TokenCollector::visit (ConstGenericParam ¶m) auto id = param.get_name ().as_string (); push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id))); push (Rust::Token::make (COLON, UNDEF_LOCATION)); - visit (param.get_type ()); + if (param.has_type ()) + visit (param.get_type ()); if (param.has_default_value ()) { push (Rust::Token::make (EQUAL, UNDEF_LOCATION)); - visit (param.get_type ()); + visit (param.get_default_value ()); } } |