consolidate information associated with function bodies

This commit is contained in:
Vern Paxson 2025-09-12 18:15:42 -07:00
parent f92acb3a4c
commit 3b37eb4b3a
5 changed files with 19 additions and 20 deletions

View file

@ -51,15 +51,14 @@ std::unordered_map<std::string, std::string> compiled_simple_funcs;
// Maps function bodies to the names we use for them.
std::unordered_map<const Stmt*, std::string> body_names;
// Maps function names to hashes of bodies.
std::unordered_map<std::string, p_hash_type> body_hashes;
struct BodyInfo {
p_hash_type hash;
int priority;
const Location* loc; // for better-than-nothing error reporting
};
// Maps function names to priorities, for hooks & event handlers.
std::unordered_map<std::string, int> body_priorities;
// Maps function names to script locations, for better-than-nothing error
// reporting.
std::unordered_map<std::string, const Location*> body_locs;
// Maps function names to their body info.
std::unordered_map<std::string, BodyInfo> body_info;
// Maps function names to events relevant to them.
std::unordered_map<std::string, std::vector<std::string>> body_events;