OCD performance fix: {find,count}+insert => insert

This commit is contained in:
Eelco Dolstra
2019-10-09 16:06:29 +02:00
parent e6e61f0a54
commit 99b73fb507
16 changed files with 32 additions and 65 deletions
+1 -2
View File
@@ -138,11 +138,10 @@ static void addAttr(ExprAttrs * attrs, AttrPath & attrPath,
static void addFormal(const Pos & pos, Formals * formals, const Formal & formal)
{
if (formals->argNames.find(formal.name) != formals->argNames.end())
if (!formals->argNames.insert(formal.name).second)
throw ParseError(format("duplicate formal function argument '%1%' at %2%")
% formal.name % pos);
formals->formals.push_front(formal);
formals->argNames.insert(formal.name);
}