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

Method createLineNumberAssoc

libchigraph/src/GraphModule.cpp:949–970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

947}
948
949boost::bimap<unsigned int, NodeInstance*> GraphModule::createLineNumberAssoc() const {
950 // create a sorted list of GraphFunctions
951 std::vector<NodeInstance*> nodes;
952 for (const auto& f : functions()) {
953 for (const auto& node : f->nodes()) {
954 assert(node.second != nullptr);
955 nodes.push_back(node.second.get());
956 }
957 }
958
959 std::sort(nodes.begin(), nodes.end(), [](const auto& lhs, const auto& rhs) {
960 return (lhs->function().name() + ":" + boost::uuids::to_string(lhs->id())) <
961 (rhs->function().name() + ":" + boost::uuids::to_string(rhs->id()));
962 });
963
964 boost::bimap<unsigned, NodeInstance*> ret;
965 for (unsigned i = 0; i < nodes.size(); ++i) {
966 ret.left.insert({i + 1, nodes[i]}); // + 1 because line numbers start at 1
967 }
968
969 return ret;
970}
971
972GraphStruct* GraphModule::structFromName(boost::string_view name) const {
973 for (const auto& str : structs()) {

Callers 3

nodeFromFrameMethod · 0.80
lineNumberFromNodeFunction · 0.80
compileFunctionFunction · 0.80

Calls 5

getMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
idMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected