Skip to content
Snippets Groups Projects
Verified Commit fa2f6c92 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

macro processor: use `map.count()` instead of `map.find()`

parent 3c546ddb
Branches
Tags
No related merge requests found
...@@ -26,7 +26,7 @@ void ...@@ -26,7 +26,7 @@ void
Environment::define(VariablePtr var, ExpressionPtr value) Environment::define(VariablePtr var, ExpressionPtr value)
{ {
string name = var->getName(); string name = var->getName();
if (functions.find(name) != functions.end()) if (functions.count(name))
throw StackTrace("Variable " + name + " was previously defined as a function"); throw StackTrace("Variable " + name + " was previously defined as a function");
variables[move(name)] = value->eval(); variables[move(name)] = value->eval();
} }
...@@ -35,7 +35,7 @@ void ...@@ -35,7 +35,7 @@ void
Environment::define(FunctionPtr func, ExpressionPtr value) Environment::define(FunctionPtr func, ExpressionPtr value)
{ {
string name = func->getName(); string name = func->getName();
if (variables.find(name) != variables.end()) if (variables.count(name))
throw StackTrace("Variable " + name + " was previously defined as a variable"); throw StackTrace("Variable " + name + " was previously defined as a variable");
functions[name] = {move(func), move(value)}; functions[name] = {move(func), move(value)};
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment