1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

IPCCompiler: Nicer error message for invalid template spelling

This commit is contained in:
Ben Wiederhake 2023-05-14 23:05:51 +02:00 committed by Jelle Raaijmakers
parent d4b0e64825
commit 3be7d393b6

View file

@ -135,6 +135,11 @@ Vector<Endpoint> parse(ByteBuffer const& file_contents)
// FIXME: This is not entirely correct. Types can have spaces, for example `HashMap<int, DeprecatedString>`.
// Maybe we should use LibCpp::Parser for parsing types.
parameter.type = lexer.consume_until([](char ch) { return isspace(ch); });
if (parameter.type.ends_with(',')) {
warnln("Parameter type '{}' looks invalid!", parameter.type);
warnln("Note that templates must not include spaces.");
VERIFY_NOT_REACHED();
}
VERIFY(!lexer.is_eof());
consume_whitespace();
parameter.name = lexer.consume_until([](char ch) { return isspace(ch) || ch == ',' || ch == ')'; });