add the super's full path to the tag's super_list

This allows for better diagonistic when the specified super doesn't exist and when super cycles are detected.
This commit is contained in:
Rafael Fillipe Silva 2023-12-20 00:21:46 -03:00 committed by Pentarctagon
parent c7e643bffd
commit a3672ba509
2 changed files with 4 additions and 4 deletions

View file

@ -156,7 +156,7 @@ const wml_key* wml_tag::find_key(const std::string& name, const config& match, b
}
}
}
for(auto& super_tag : super_refs_) {
for(auto& [_, super_tag] : super_refs_) {
if(const wml_key* found_key = super_tag->find_key(name, match, false, visited)) {
return found_key;
}
@ -255,7 +255,7 @@ const wml_tag* wml_tag::find_tag(const std::string& fullpath, const wml_tag& roo
}
}
}
for(auto& super_tag : super_refs_) {
for(auto& [_, super_tag] : super_refs_) {
if(const wml_tag* found_tag = super_tag->find_tag(fullpath, root, match, false, visited)) {
return found_tag;
}
@ -387,7 +387,7 @@ void wml_tag::expand(wml_tag& root)
wml_tag* super_tag = root.find_tag(super, root, config());
if(super_tag) {
if(super_tag != this) {
super_refs_.push_back(super_tag);
super_refs_.emplace(super, super_tag);
} else {
// TODO: Detect super cycles too!
//PLAIN_LOG << "the same" << super_tag->name_;

View file

@ -51,7 +51,7 @@ public:
using key_map = std::map<std::string, wml_key>;
using link_map = std::map<std::string, std::string>;
using condition_list = std::vector<wml_condition>;
using super_list = std::vector<wml_tag*>;
using super_list = std::map<std::string, const wml_tag*>;
private:
static void push_new_tag_conditions(std::queue<const wml_tag*>& q, const config& match, const wml_tag& tag);
template<typename T, typename Map = std::map<std::string, T>>