Skip to content

Commit

Permalink
Fix: don't run after_reading multiple times when there are included f…
Browse files Browse the repository at this point in the history
…iles
  • Loading branch information
twanvl committed Apr 27, 2020
1 parent 2c16527 commit f4b2a43
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/util/io/reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -173,7 +177,7 @@ class Reader {
// 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();
Expand Down

0 comments on commit f4b2a43

Please sign in to comment.