Fix some minor issues found by clang's static analyzer
This commit is contained in:
@@ -1459,12 +1459,9 @@ namespace chaiscript
|
|||||||
* Reads a switch statement from input
|
* Reads a switch statement from input
|
||||||
*/
|
*/
|
||||||
bool Switch() {
|
bool Switch() {
|
||||||
bool retval = false;
|
|
||||||
|
|
||||||
size_t prev_stack_top = m_match_stack.size();
|
size_t prev_stack_top = m_match_stack.size();
|
||||||
|
|
||||||
if (Keyword("switch")) {
|
if (Keyword("switch")) {
|
||||||
retval = true;
|
|
||||||
|
|
||||||
if (!Char('(')) {
|
if (!Char('(')) {
|
||||||
throw exception::eval_error("Incomplete 'switch' expression", File_Position(m_line, m_col), *m_filename);
|
throw exception::eval_error("Incomplete 'switch' expression", File_Position(m_line, m_col), *m_filename);
|
||||||
@@ -1477,8 +1474,6 @@ namespace chaiscript
|
|||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
|
|
||||||
if (Char('{')) {
|
if (Char('{')) {
|
||||||
retval = true;
|
|
||||||
|
|
||||||
while (Eol()) {}
|
while (Eol()) {}
|
||||||
|
|
||||||
while (Case()) {
|
while (Case()) {
|
||||||
@@ -1496,9 +1491,12 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
|
|
||||||
build_match(AST_NodePtr(new eval::Switch_AST_Node()), prev_stack_top);
|
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;
|
bool saw_eol = true;
|
||||||
|
|
||||||
while (has_more) {
|
while (has_more) {
|
||||||
has_more = false;
|
|
||||||
int prev_line = m_line;
|
int prev_line = m_line;
|
||||||
int prev_col = m_col;
|
int prev_col = m_col;
|
||||||
if (Def()) {
|
if (Def()) {
|
||||||
|
Reference in New Issue
Block a user