| 387 | } |
| 388 | |
| 389 | NamedDataType GraphFunction::getOrCreateLocalVariable(std::string name, DataType type, |
| 390 | bool* inserted) { |
| 391 | auto local = localVariableFromName(name); |
| 392 | |
| 393 | if (local.valid()) { |
| 394 | if (inserted != nullptr) { *inserted = false; } |
| 395 | return local; |
| 396 | } |
| 397 | |
| 398 | // invalidate the cache |
| 399 | module().updateLastEditTime(); |
| 400 | |
| 401 | mLocalVariables.emplace_back(name, type); |
| 402 | if (inserted != nullptr) { *inserted = true; } |
| 403 | |
| 404 | return mLocalVariables[mLocalVariables.size() - 1]; |
| 405 | } |
| 406 | |
| 407 | bool GraphFunction::removeLocalVariable(boost::string_view name) { |
| 408 | auto iter = std::find_if(mLocalVariables.begin(), mLocalVariables.end(), |
no test coverage detected