MCPcopy Create free account
hub / github.com/chigraph/chigraph / removeLocalVariable

Method removeLocalVariable

libchigraph/src/GraphFunction.cpp:407–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405}
406
407bool 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
430void GraphFunction::renameLocalVariable(std::string oldName, std::string newName) {
431 // invalidate the cache

Callers 1

Calls 5

beginMethod · 0.80
endMethod · 0.80
updateLastEditTimeMethod · 0.80
fullNameMethod · 0.80
to_stringMethod · 0.80

Tested by

no test coverage detected