| Index: runtime/vm/parser.cc
|
| ===================================================================
|
| --- runtime/vm/parser.cc (revision 29929)
|
| +++ runtime/vm/parser.cc (working copy)
|
| @@ -6875,8 +6875,7 @@
|
|
|
| // Parse the individual catch handler code and add an unconditional JUMP
|
| // to the end of the try block.
|
| - ExpectToken(Token::kLBRACE);
|
| - OpenBlock();
|
| + OpenBlock(); // Block for the exception and stack trace variables.
|
| AddCatchParametersToScope(&exception_param, &stack_trace_param,
|
| current_block_->scope);
|
|
|
| @@ -6906,11 +6905,13 @@
|
| no_args));
|
| }
|
|
|
| - ParseStatementSequence(); // Parse the catch handler code.
|
| - current_block_->statements->Add(
|
| + // Parse the catch handler code.
|
| + if (CurrentToken() != Token::kLBRACE) {
|
| + ErrorMsg("'{' expected");
|
| + }
|
| + SequenceNode* catch_block = ParseNestedStatement(false, NULL);
|
| + catch_block->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();
|
| @@ -6931,7 +6932,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_handler, NULL));
|
| + new IfNode(catch_pos, type_cond_expr, catch_block, 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
|
| @@ -6950,13 +6951,16 @@
|
| }
|
| // No exception type exists in the catch specifier so execute the
|
| // catch handler code unconditionally.
|
| - current_block_->statements->Add(catch_handler);
|
| + current_block_->statements->Add(catch_block);
|
| 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();
|
|
|