if (optimize) { // If both sides are empty, the if statement can be reduced to its test expression.
trueIsEmpty = ifTrue->isEmpty();
falseIsEmpty = !ifFalse || ifFalse->isEmpty(); if (trueIsEmpty && falseIsEmpty) { return ExpressionStatement::Make(context, std::move(test));
}
}
if (optimize) { // Static Boolean values can fold down to a single branch. const Expression* testValue = ConstantFolder::GetConstantValueForVariable(*test); if (testValue->isBoolLiteral()) { if (testValue->as<Literal>().boolValue()) { return replace_empty_with_nop(std::move(ifTrue), trueIsEmpty);
} else { return replace_empty_with_nop(std::move(ifFalse), falseIsEmpty);
}
}
}
if (optimize) { // Replace an empty if-true branches with Nop; eliminate empty if-false branches entirely.
ifTrue = replace_empty_with_nop(std::move(ifTrue), trueIsEmpty); if (falseIsEmpty) {
ifFalse = nullptr;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.