Simplify listInstancePath_class
This is now in line with the condition in leafListElementPath_class.
Change-Id: Ic5a92c8b4e1a88215d0e197bbd67c2616811c99b
diff --git a/src/ast_handlers.hpp b/src/ast_handlers.hpp
index ca39b21..540d7e2 100644
--- a/src/ast_handlers.hpp
+++ b/src/ast_handlers.hpp
@@ -197,13 +197,7 @@
void on_success(Iterator const&, Iterator const&, T& ast, Context const& context)
{
auto& parserContext = x3::get<parser_context_tag>(context);
- if (ast.m_nodes.empty()) {
- parserContext.m_errorMsg = "This is not a list instance.";
- _pass(context) = false;
- return;
- }
-
- if (!std::holds_alternative<listElement_>(ast.m_nodes.back().m_suffix)) {
+ if (ast.m_nodes.empty() || !std::holds_alternative<listElement_>(ast.m_nodes.back().m_suffix)) {
parserContext.m_errorMsg = "This is not a list instance.";
_pass(context) = false;
}