lint: Use early exit/continue

This commit is contained in:
Kurtis Rader 2016-10-30 20:26:10 -07:00
parent d441de33e5
commit 520f810bf9

View file

@ -372,7 +372,10 @@ parse_execution_result_t parse_execution_context_t::run_function_statement(
wcstring_list_t argument_list;
parse_execution_result_t result = this->determine_arguments(header, &argument_list, failglob);
if (result == parse_execution_success) {
if (result != parse_execution_success) {
return result;
}
// The function definition extends from the end of the header to the function end. It's not
// just the range of the contents because that loses comments - see issue #1710.
assert(block_end_command.has_source());
@ -403,7 +406,7 @@ parse_execution_result_t parse_execution_context_t::run_function_statement(
this->report_error(header, L"%ls", error_str.c_str());
result = parse_execution_errored;
}
}
return result;
}
@ -546,7 +549,10 @@ parse_execution_result_t parse_execution_context_t::run_switch_statement(
switch_values_expanded.size());
}
if (result == parse_execution_success) {
if (result != parse_execution_success) {
return result;
}
const wcstring &switch_value_expanded = switch_values_expanded.at(0).completion;
switch_block_t *sb = new switch_block_t();
@ -604,8 +610,6 @@ parse_execution_result_t parse_execution_context_t::run_switch_statement(
}
parser->pop_block(sb);
}
return result;
}