Put empty path checking to a function
Instead of checking for .empty() everywhere I'm pushing path fragments,
do it once in a new function called pushFragment, which resolves nodeup_
fragments.
Change-Id: I2528f814991eed5218d8272ea386bd732a7448a5
diff --git a/src/interpreter.cpp b/src/interpreter.cpp
index 43fc329..3543e93 100644
--- a/src/interpreter.cpp
+++ b/src/interpreter.cpp
@@ -279,13 +279,7 @@
}
for (const auto& fragment : suffix.m_nodes) {
- if (std::holds_alternative<nodeup_>(fragment.m_suffix)) {
- if (!res.m_nodes.empty()) { // Allow going up, when already at root
- res.m_nodes.pop_back();
- }
- } else {
- res.m_nodes.push_back(fragment);
- }
+ res.pushFragment(fragment);
}
return res;