Skip to content

Commit 4448fd9

Browse files
committed
Compiler: Do not allow duplicate procedure arguments
1 parent e3c232b commit 4448fd9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/engine/compiler.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ void Compiler::addFunctionCall(BlockFunc f)
167167
/*! Adds an argument to a procedure (custom block). */
168168
void Compiler::addProcedureArg(std::string procCode, std::string argName)
169169
{
170+
if (impl->procedureArgs.find(procCode) != impl->procedureArgs.cend()) {
171+
const auto &procedure = impl->procedureArgs[procCode];
172+
173+
if (std::find(procedure.begin(), procedure.end(), argName) != procedure.end())
174+
return;
175+
}
176+
170177
impl->procedureArgs[procCode].push_back(argName);
171178
}
172179

0 commit comments

Comments
 (0)