Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 045a1f00 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

FIX: Fix option/function/job add for IrModule

parent 64a33a1e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!25Draft: New Vivy module spec
...@@ -120,16 +120,19 @@ IrModule::addImport(IrImport *importStatement) ...@@ -120,16 +120,19 @@ IrModule::addImport(IrImport *importStatement)
void void
IrModule::addOption(IrOption *obj) IrModule::addOption(IrOption *obj)
{ {
if (option(obj->name()) != nullptr) if (option(obj->name()) == nullptr) {
localOptions.push_back(obj); localOptions.push_back(obj);
else } else {
throw std::runtime_error("Can't add multiple times an option with the same name"); throw std::runtime_error("Can't add multiple times an option with the same name, "
"duplicate name is: " +
obj->name().toStdString());
}
} }
void void
IrModule::addFunction(IrFunction *obj) IrModule::addFunction(IrFunction *obj)
{ {
if (function(obj->name()) != nullptr) if (function(obj->name()) == nullptr)
localFunctions.push_back(obj); localFunctions.push_back(obj);
else else
throw std::runtime_error("Can't add multiple times an function with the same name"); throw std::runtime_error("Can't add multiple times an function with the same name");
...@@ -138,7 +141,7 @@ IrModule::addFunction(IrFunction *obj) ...@@ -138,7 +141,7 @@ IrModule::addFunction(IrFunction *obj)
void void
IrModule::addJob(IrJob *obj) IrModule::addJob(IrJob *obj)
{ {
if (job(obj->name()) != nullptr) if (job(obj->name()) == nullptr)
localJobs.push_back(obj); localJobs.push_back(obj);
else else
throw std::runtime_error("Can't add multiple times an job with the same name"); throw std::runtime_error("Can't add multiple times an job with the same name");
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter