Skip to content

Commit

Permalink
Small fix to the ast collector visitor
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
P-E-P authored and CohenArthur committed Nov 6, 2023
1 parent fb346fa commit e7caf68
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gcc/rust/ast/rust-ast-collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -534,11 +534,12 @@ TokenCollector::visit (ConstGenericParam &param)
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 ());
}
}

Expand Down

0 comments on commit e7caf68

Please sign in to comment.