From f4b2a4316fecbe22f4efd5e07fc17183a8de26d3 Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Mon, 27 Apr 2020 14:23:26 +0200 Subject: [PATCH] Fix: don't run after_reading multiple times when there are included files --- src/util/io/reader.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/util/io/reader.hpp b/src/util/io/reader.hpp index 2f95f4eb..9f54edc6 100644 --- a/src/util/io/reader.hpp +++ b/src/util/io/reader.hpp @@ -60,12 +60,16 @@ class Reader { /// Handle an object that can read as much as it can eat template void handle_greedy(T& object) { + handle_greedy_without_validate(object); + after_reading(object, file_app_version); + } + template + 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 @@ 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();