FallThroughScope: remove SwitchBreak type

A `SwitchBreak` node should not have a specific associated
`FallThroughScopeType`, since its semantics represent the fact of a
`case` of the `switch` with no associated statements, and thus can be
represented with the `FallThrough` behavior.
This commit is contained in:
Andrea Gussoni
2024-04-30 15:40:58 +02:00
parent 54e656ce62
commit a6e96dcb93
3 changed files with 5 additions and 4 deletions
@@ -227,7 +227,10 @@ fallThroughScopeImpl(const model::Binary &Model,
rc_return FallThroughScopeType::FallThrough;
} break;
case ASTNode::NK_SwitchBreak: {
rc_return FallThroughScopeType::SwitchBreak;
// `The `SwitchBreak` represents the fact that we fallthrough from the
// switch out
rc_return FallThroughScopeType::FallThrough;
} break;
case ASTNode::NK_Continue: {
rc_return FallThroughScopeType::Continue;
@@ -21,7 +21,6 @@ enum class FallThroughScopeType {
Return,
Continue,
LoopBreak,
SwitchBreak,
};
using FallThroughScopeTypeMap = std::map<const ASTNode *, FallThroughScopeType>;
+1 -2
View File
@@ -30,8 +30,7 @@ static bool isPreferredAsFallThrough(FallThroughScopeType Element) {
switch (Element) {
case FallThroughScopeType::Return:
case FallThroughScopeType::Continue:
case FallThroughScopeType::LoopBreak:
case FallThroughScopeType::SwitchBreak: {
case FallThroughScopeType::LoopBreak: {
return true;
} break;
case FallThroughScopeType::FallThrough: