From 0fd4b828f2721f16e392ef2d5c0944ce2b9bffd2 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Sat, 19 May 2012 09:16:21 -0600 Subject: [PATCH] Fix some minor issues found by clang's static analyzer --- include/chaiscript/language/chaiscript_parser.hpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/include/chaiscript/language/chaiscript_parser.hpp b/include/chaiscript/language/chaiscript_parser.hpp index fd58ef2c..0e186e30 100644 --- a/include/chaiscript/language/chaiscript_parser.hpp +++ b/include/chaiscript/language/chaiscript_parser.hpp @@ -1459,12 +1459,9 @@ namespace chaiscript * Reads a switch statement from input */ bool Switch() { - bool retval = false; - size_t prev_stack_top = m_match_stack.size(); if (Keyword("switch")) { - retval = true; if (!Char('(')) { throw exception::eval_error("Incomplete 'switch' expression", File_Position(m_line, m_col), *m_filename); @@ -1477,8 +1474,6 @@ namespace chaiscript while (Eol()) {} if (Char('{')) { - retval = true; - while (Eol()) {} while (Case()) { @@ -1496,9 +1491,12 @@ namespace chaiscript } build_match(AST_NodePtr(new eval::Switch_AST_Node()), prev_stack_top); + return true; + + } else { + return false; } - return retval; } /** @@ -1971,7 +1969,6 @@ namespace chaiscript bool saw_eol = true; while (has_more) { - has_more = false; int prev_line = m_line; int prev_col = m_col; if (Def()) {