mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-26 00:13:52 +00:00
Fix an issue with schema validator not reporting errors at top level
This commit is contained in:
parent
f43c52cdbf
commit
5ec1d80bc1
@ -282,12 +282,15 @@ void schema_validator::close_tag()
|
||||
{
|
||||
stack_.pop();
|
||||
counter_.pop();
|
||||
// cache_ is cleared in another place.
|
||||
// cache_ is normally cleared in another place.
|
||||
// However, if we're closing the root tag, clear it now
|
||||
if(stack_.empty()) {
|
||||
print_cache();
|
||||
}
|
||||
}
|
||||
|
||||
void schema_validator::validate(const config& cfg, const std::string& name, int start_line, const std::string& file)
|
||||
void schema_validator::print_cache()
|
||||
{
|
||||
// close previous errors and print them to output.
|
||||
for(auto& m : cache_.top()) {
|
||||
for(auto& list : m.second) {
|
||||
print(list);
|
||||
@ -295,6 +298,12 @@ void schema_validator::validate(const config& cfg, const std::string& name, int
|
||||
}
|
||||
|
||||
cache_.pop();
|
||||
}
|
||||
|
||||
void schema_validator::validate(const config& cfg, const std::string& name, int start_line, const std::string& file)
|
||||
{
|
||||
// close previous errors and print them to output.
|
||||
print_cache();
|
||||
|
||||
// clear cache
|
||||
auto cache_it = cache_.top().find(&cfg);
|
||||
|
@ -118,6 +118,7 @@ protected:
|
||||
|
||||
virtual void print(message_info&);
|
||||
private:
|
||||
void print_cache();
|
||||
|
||||
typedef std::deque<message_info> message_list;
|
||||
typedef std::map<const config*, message_list> message_map;
|
||||
|
Loading…
x
Reference in New Issue
Block a user