Simplify variant in ls_
Change-Id: I2bccf7b171f0bae619e935edba5a157a2398d877
diff --git a/src/parser.cpp b/src/parser.cpp
index 57511d3..794cc25 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -110,10 +110,15 @@
{
return path;
}
+
+ [[noreturn]] schemaPath_ operator()([[maybe_unused]] const module_& path) const
+ {
+ throw std::logic_error("getSchemaPathVisitor: Tried getting a schema path from a module");
+ }
};
-std::set<std::string> Parser::availableNodes(const boost::optional<boost::variant<boost::variant<dataPath_, schemaPath_>, module_>>& path, const Recursion& option) const
+std::set<std::string> Parser::availableNodes(const boost::optional<boost::variant<dataPath_, schemaPath_, module_>>& path, const Recursion& option) const
{
auto pathArg = dataPathToSchemaPath(m_curDir);
if (path) {
@@ -121,7 +126,7 @@
return m_schema->moduleNodes(boost::get<module_>(*path), option);
}
- auto schemaPath = boost::apply_visitor(getSchemaPathVisitor(), boost::get<boost::variant<dataPath_, schemaPath_>>(*path));
+ auto schemaPath = boost::apply_visitor(getSchemaPathVisitor(), *path);
if (schemaPath.m_scope == Scope::Absolute) {
pathArg = schemaPath;
} else {