Commit 4000db35 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[torque] disallow try blocks without labels or catch

Bug: v8:7793
Change-Id: Ie17013927cc9af002ba843eaa29e53f1a50df674
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2162726Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67335}
parent aeb921c9
This diff is collapsed.
......@@ -1514,6 +1514,9 @@ base::Optional<ParseResult> MakeTryLabelExpression(
Statement* result = try_block;
auto label_blocks = child_results->NextAs<std::vector<LabelBlock*>>();
auto catch_block = child_results->NextAs<base::Optional<LabelBlock*>>();
if (label_blocks.empty() && !catch_block.has_value()) {
Error("Try blocks without catch or label don't make sense.");
}
for (auto block : label_blocks) {
result = MakeNode<ExpressionStatement>(MakeNode<TryLabelExpression>(
false, MakeNode<StatementExpression>(result), block));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment