diff options
Diffstat (limited to 'src/buildtool/file_system/file_root.hpp')
-rw-r--r-- | src/buildtool/file_system/file_root.hpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/buildtool/file_system/file_root.hpp b/src/buildtool/file_system/file_root.hpp index ce92ab1e..e47b68f5 100644 --- a/src/buildtool/file_system/file_root.hpp +++ b/src/buildtool/file_system/file_root.hpp @@ -827,25 +827,17 @@ class FileRoot { FileRoot{std::string{root[1]}, /*ignore_special=*/true}, std::nullopt}; } - if (root[0] == FileRoot::kComputedMarker) { - // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers) - if (root.size() != 5 or (not root[1].is_string()) or - (not root[2].is_string()) or (not root[3].is_string()) or - (not root[4].is_object())) { - return unexpected{fmt::format( - "{} scheme requires, in this order, the arugments root, " - "module, name, config. However found {} for {} of " - "repository {}", - kComputedMarker, - root.dump(), - keyword, - repo)}; - } - return ResultType{FileRoot{std::string{root[1]}, - std::string{root[2]}, - std::string{root[3]}, - root[4]}, - std::nullopt}; + if (PrecomputedRoot::IsPrecomputedMarker(root[0])) { + auto precomputed = PrecomputedRoot::Parse(root); + if (not precomputed) { + return unexpected{ + fmt::format("While parsing {} for {} of repository{}:\n{}", + root.dump(), + keyword, + repo, + std::move(precomputed).error())}; + } + return ResultType{FileRoot{*std::move(precomputed)}, std::nullopt}; } return unexpected{fmt::format( "Unknown scheme in the specification {} of {} of repository {}", |