Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Unified Diff: runtime/vm/parser.cc

Issue 60343006: Revert 29947 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/try_catch_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 29948)
+++ runtime/vm/parser.cc (working copy)
@@ -6875,7 +6875,8 @@
// Parse the individual catch handler code and add an unconditional JUMP
// to the end of the try block.
- OpenBlock(); // Block for the exception and stack trace variables.
+ ExpectToken(Token::kLBRACE);
+ OpenBlock();
AddCatchParametersToScope(&exception_param, &stack_trace_param,
current_block_->scope);
@@ -6905,13 +6906,11 @@
no_args));
}
- // Parse the catch handler code.
- if (CurrentToken() != Token::kLBRACE) {
- ErrorMsg("'{' expected");
- }
- SequenceNode* catch_block = ParseNestedStatement(false, NULL);
- catch_block->Add(
+ ParseStatementSequence(); // Parse the catch handler code.
+ current_block_->statements->Add(
new JumpNode(catch_pos, Token::kCONTINUE, end_catch_label));
+ SequenceNode* catch_handler = CloseBlock();
+ ExpectToken(Token::kRBRACE);
const bool is_bad_type = exception_param.type.IsMalformed() ||
exception_param.type.IsMalbounded();
@@ -6932,7 +6931,7 @@
AstNode* type_cond_expr = new ComparisonNode(
catch_pos, Token::kIS, exception_value, exception_type);
current_block_->statements->Add(
- new IfNode(catch_pos, type_cond_expr, catch_block, NULL));
+ new IfNode(catch_pos, type_cond_expr, catch_handler, NULL));
// Do not add uninstantiated types (e.g. type parameter T or generic
// type List<T>), since the debugger won't be able to instantiate it
@@ -6951,16 +6950,13 @@
}
// No exception type exists in the catch specifier so execute the
// catch handler code unconditionally.
- current_block_->statements->Add(catch_block);
+ current_block_->statements->Add(catch_handler);
generic_catch_seen = true;
// This catch clause will handle all exceptions. We can safely forget
// all previous catch clause types.
handler_types.SetLength(0);
handler_types.Add(exception_param.type);
}
- // Add this individual catch handler to the catch handlers list.
- SequenceNode* catch_clause = CloseBlock();
- current_block_->statements->Add(catch_clause);
}
SequenceNode* catch_handler_list = CloseBlock();
TryBlocks* inner_try_block = PopTryBlock();
« no previous file with comments | « no previous file | tests/language/try_catch_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698