| 405 | } |
| 406 | |
| 407 | bool GraphFunction::removeLocalVariable(boost::string_view name) { |
| 408 | auto iter = std::find_if(mLocalVariables.begin(), mLocalVariables.end(), |
| 409 | [&](auto& toTest) { return toTest.name == name; }); |
| 410 | |
| 411 | bool erased = false; |
| 412 | if (iter != mLocalVariables.end()) { |
| 413 | mLocalVariables.erase(iter); |
| 414 | erased = true; |
| 415 | } |
| 416 | if (!erased) { return false; } |
| 417 | |
| 418 | // invalidate the cache |
| 419 | module().updateLastEditTime(); |
| 420 | |
| 421 | // remove set and get nodes |
| 422 | auto setNodes = nodesWithType(module().fullName(), "_set_" + name.to_string()); |
| 423 | for (const auto& node : setNodes) { removeNode(*node); } |
| 424 | auto getNodes = nodesWithType(module().fullName(), "_get_" + name.to_string()); |
| 425 | for (const auto& node : getNodes) { removeNode(*node); } |
| 426 | |
| 427 | return true; |
| 428 | } |
| 429 | |
| 430 | void GraphFunction::renameLocalVariable(std::string oldName, std::string newName) { |
| 431 | // invalidate the cache |
no test coverage detected