summaryrefslogtreecommitdiff
path: root/src/buildtool/build_engine/expression
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/build_engine/expression')
-rw-r--r--src/buildtool/build_engine/expression/evaluator.cpp20
-rw-r--r--src/buildtool/build_engine/expression/target_node.hpp30
2 files changed, 21 insertions, 29 deletions
diff --git a/src/buildtool/build_engine/expression/evaluator.cpp b/src/buildtool/build_engine/expression/evaluator.cpp
index 18fe7a76..ea2f547e 100644
--- a/src/buildtool/build_engine/expression/evaluator.cpp
+++ b/src/buildtool/build_engine/expression/evaluator.cpp
@@ -1399,17 +1399,11 @@ auto Evaluator::EvaluateExpression(
FunctionMap::MakePtr(kBuiltInFunctions, provider_functions));
} catch (EvaluationError const& ex) {
if (ex.UserContext()) {
- try {
- note_user_context();
- } catch (...) {
- // should not throw
- }
+ note_user_context();
}
- else {
- if (ex.WhileEvaluation()) {
- ss << "Expression evaluation traceback (most recent call last):"
- << std::endl;
- }
+ else if (ex.WhileEvaluation()) {
+ ss << "Expression evaluation traceback (most recent call last):"
+ << std::endl;
}
ss << ex.what();
for (auto const& object : ex.InvolvedObjects()) {
@@ -1418,11 +1412,7 @@ auto Evaluator::EvaluateExpression(
} catch (std::exception const& ex) {
ss << ex.what();
}
- try {
- logger(ss.str());
- } catch (...) {
- // should not throw
- }
+ logger(ss.str());
return ExpressionPtr{nullptr};
}
diff --git a/src/buildtool/build_engine/expression/target_node.hpp b/src/buildtool/build_engine/expression/target_node.hpp
index feed94d6..1e7cbd2e 100644
--- a/src/buildtool/build_engine/expression/target_node.hpp
+++ b/src/buildtool/build_engine/expression/target_node.hpp
@@ -62,21 +62,23 @@ class TargetNode {
[[nodiscard]] auto operator==(TargetNode const& other) const noexcept
-> bool {
- if (data_.index() == other.data_.index()) {
- try {
- if (IsValue()) {
- return GetValue() == other.GetValue();
- }
- auto const& abs_l = GetAbstract();
- auto const& abs_r = other.GetAbstract();
- return abs_l.node_type == abs_r.node_type and
- abs_l.string_fields == abs_r.string_fields and
- abs_l.target_fields == abs_r.string_fields;
- } catch (...) {
- // should never happen
+ if (data_.index() != other.data_.index()) {
+ return false;
+ }
+
+ try {
+ if (IsValue()) {
+ return GetValue() == other.GetValue();
}
+ auto const& abs_l = GetAbstract();
+ auto const& abs_r = other.GetAbstract();
+ return abs_l.node_type == abs_r.node_type and
+ abs_l.string_fields == abs_r.string_fields and
+ abs_l.target_fields == abs_r.string_fields;
+ } catch (...) {
+ // should never happen
+ return false;
}
- return false;
}
[[nodiscard]] auto ToString() const noexcept -> std::string {
@@ -84,8 +86,8 @@ class TargetNode {
return ToJson().dump();
} catch (...) {
// should never happen
+ return {};
}
- return {};
}
[[nodiscard]] auto ToJson() const -> nlohmann::json;