Fix: don't run after_reading multiple times when there are included files

This commit is contained in:
Twan van Laarhoven
2020-04-27 14:23:26 +02:00
parent 2c165271be
commit f4b2a4316f
+6 -2
View File
@@ -60,12 +60,16 @@ class Reader {
/// Handle an object that can read as much as it can eat
template <typename T>
void handle_greedy(T& object) {
handle_greedy_without_validate(object);
after_reading(object, file_app_version);
}
template <typename T>
void handle_greedy_without_validate(T& object) {
do {
handle(object);
if (state != HANDLED) unknownKey(object);
state = OUTSIDE;
} while (indent >= expected_indent);
after_reading(object, file_app_version);
}
/// Handle an object: read it if it's name matches
@@ -173,7 +177,7 @@ private:
// in an included file, use the app version of the parent if there is none
sub_reader.file_app_version = file_app_version;
}
sub_reader.handle_greedy(v);
sub_reader.handle_greedy_without_validate(v);
moveNext();
} else {
unknownKey();