Parser.hpp: Prevent the redefinition of functions

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2022-05-26 11:55:25 +02:00
parent f0128bf0c3
commit a8e514d67f
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 2 additions and 0 deletions

View File

@ -88,6 +88,8 @@ namespace Parser {
i += parametersDistance;
}
if (nextAre({LCOMP, LCOMP, LBRACE})) {
if (parseTree.template findReferenceByName<Function>(current.toktext).has_value())
parsingError(current, " is already defined", true);
Function function(current.toktext);
if (parametersDistance > 2) {
function.parameters = parse(filter_comma_list(lexed.begin() + ((i + 2) - parametersDistance), lexed.begin() + i));