diff options
Diffstat (limited to 'src/ir/properties.h')
-rw-r--r-- | src/ir/properties.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ir/properties.h b/src/ir/properties.h index b60c74d98..8ae7befba 100644 --- a/src/ir/properties.h +++ b/src/ir/properties.h @@ -69,13 +69,15 @@ inline bool isControlFlowStructure(Expression* curr) { curr->is<Try>(); } -// Check if an expression is a control flow construct with a name, -// which implies it may have breaks to it. +// Check if an expression is a control flow construct with a name, which implies +// it may have breaks or delegates to it. inline bool isNamedControlFlow(Expression* curr) { if (auto* block = curr->dynCast<Block>()) { return block->name.is(); } else if (auto* loop = curr->dynCast<Loop>()) { return loop->name.is(); + } else if (auto* try_ = curr->dynCast<Try>()) { + return try_->name.is(); } return false; } @@ -104,6 +106,10 @@ inline bool isConstantExpression(const Expression* curr) { return false; } +inline bool isBranch(const Expression* curr) { + return curr->is<Break>() || curr->is<Switch>() || curr->is<BrOn>(); +} + inline Literal getLiteral(const Expression* curr) { if (auto* c = curr->dynCast<Const>()) { return c->value; |