summaryrefslogtreecommitdiff
path: root/src/buildtool/build_engine/base_maps/expression_map.cpp
diff options
context:
space:
mode:
authorAlberto Sartori <alberto.sartori@huawei.com>2022-03-28 11:59:10 +0200
committerAlberto Sartori <alberto.sartori@huawei.com>2022-03-29 09:57:48 +0200
commit51cbf8f11f15062f23317d676364ca690b1edc92 (patch)
tree5ef96b087221012fa4bdec5e4a0540172c97c3d3 /src/buildtool/build_engine/base_maps/expression_map.cpp
parent8aea452283f58c252f992c83dafa614d645466b2 (diff)
downloadjustbuild-51cbf8f11f15062f23317d676364ca690b1edc92.tar.gz
refactor EntityName
EntityName now clearly expresses its double identity: - NamedTarget - AnonymousTarget The usage of std::variant<NamedTarget,AnonymousTarget> guarantees that EntityName, internally, is not a mix of the two - like could happen before this patch. NamedTarget features an enum ReferenceType to express the type of the target, namely, "normal target" or an "explicit file reference". Thanks to this refactoring, the introduction of new targets type should be easier, since the design is more modular. NamedTarget
Diffstat (limited to 'src/buildtool/build_engine/base_maps/expression_map.cpp')
-rw-r--r--src/buildtool/build_engine/base_maps/expression_map.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/buildtool/build_engine/base_maps/expression_map.cpp b/src/buildtool/build_engine/base_maps/expression_map.cpp
index df464b15..4274674e 100644
--- a/src/buildtool/build_engine/base_maps/expression_map.cpp
+++ b/src/buildtool/build_engine/base_maps/expression_map.cpp
@@ -29,11 +29,12 @@ auto CreateExpressionMap(gsl::not_null<ExpressionFileMap*> const& expr_file_map,
logger,
subcaller = std::move(subcaller),
id](auto json_values) {
- auto func_it = json_values[0]->find(id.name);
+ auto const& target_ = id.GetNamedTarget();
+ auto func_it = json_values[0]->find(target_.name);
if (func_it == json_values[0]->end()) {
(*logger)(fmt::format("Cannot find expression {} in {}",
- id.name,
- id.module),
+ target_.name,
+ target_.module),
true);
return;
}
@@ -79,7 +80,7 @@ auto CreateExpressionMap(gsl::not_null<ExpressionFileMap*> const& expr_file_map,
},
[logger, id](auto msg, auto fatal) {
(*logger)(fmt::format("While reading expression file in {}: {}",
- id.module,
+ id.GetNamedTarget().module,
msg),
fatal);
});