LibIDL: Report empty types with a separate error

Previously the IDL Parser Complained, that a type with the name ''
(an empty string) couldn't be found. It wasn't that easy to see the
mistake, as the not named type is printed without '' around it, so the
message seemed to miss a type. This now catches this specify error
earlier and reports it cleanly to the user. An example of this
occurring would be ''typedef A (B or //FIXME: C )
This commit is contained in:
Totto16 2025-03-03 18:09:35 +01:00 committed by Tim Ledbetter
parent d14856e3c5
commit 1182ee6c69
Notes: github-actions[bot] 2025-03-04 08:32:33 +00:00

View file

@ -295,6 +295,10 @@ NonnullRefPtr<Type const> Parser::parse_type()
// Note: This case is handled above
}
if (builder.is_empty()) {
report_parsing_error("Type can't be an empty string"sv, filename, input, lexer.tell());
}
if (is_parameterized_type)
return adopt_ref(*new ParameterizedType(builder.to_byte_string(), nullable, move(parameters)));