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>
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 ());
}
}