Parser.hpp: Shorten two "if" statements
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
46a09217fe
commit
7ebf0ab5a4
|
@ -89,9 +89,8 @@ namespace Parser {
|
|||
}
|
||||
if (nextAre({LCOMP, LCOMP, LBRACE})) {
|
||||
Function function(current.toktext);
|
||||
if (parametersDistance > 2) {
|
||||
if (parametersDistance > 2)
|
||||
function.parameters = parse(filter_comma_list(lexed.begin() + ((i + 2) - parametersDistance), lexed.begin() + i));
|
||||
}
|
||||
parseTree << function;
|
||||
i += 2;
|
||||
break;
|
||||
|
@ -100,11 +99,8 @@ namespace Parser {
|
|||
bool isFinalDefine = nextAre({TAG, DEFINE});
|
||||
if (isFinalDefine || next.toktype == DEFINE) {
|
||||
const optional previousDefinition = parseTree.template findReferenceByName<Define>(current.toktext);
|
||||
if (previousDefinition.has_value()) {
|
||||
if (previousDefinition.value().get().final || isFinalDefine) {
|
||||
parsingError(current, previousDefinition->get().final ? " cannot be redefined as it is final" : " cannot be made final after it has been declared", true);
|
||||
}
|
||||
}
|
||||
if (previousDefinition.has_value() && (previousDefinition.value().get().final || isFinalDefine))
|
||||
parsingError(current, previousDefinition->get().final ? " cannot be redefined as it is final" : " cannot be made final after it has been declared", true);
|
||||
const unsigned increment = 2 + isFinalDefine;
|
||||
const auto beginning = lexed.begin() + i + increment;
|
||||
const auto end = find_if(beginning, lexed.end(), [¤t](const tok& it){
|
||||
|
|
Loading…
Reference in New Issue