diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-10-25 16:51:31 +0200 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-11-06 17:13:22 +0000 |
commit | e7caf68fe08f371102b605450e5a9ab516e2a90b (patch) | |
tree | 3406e18e0c6ea899fefa4a834e25c282fd20211c /gcc/rust | |
parent | fb346fab74307399234e1bf8891332943eabb8d6 (diff) | |
download | gcc-e7caf68fe08f371102b605450e5a9ab516e2a90b.zip gcc-e7caf68fe08f371102b605450e5a9ab516e2a90b.tar.gz gcc-e7caf68fe08f371102b605450e5a9ab516e2a90b.tar.bz2 |
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>
Diffstat (limited to 'gcc/rust')
-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 ()); } } |