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

Unified Diff: runtime/vm/parser.cc

Issue 11883023: Collect debugging info for catch clauses (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months 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 | « runtime/vm/object_test.cc ('k') | runtime/vm/raw_object.h » ('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 17099)
+++ runtime/vm/parser.cc (working copy)
@@ -5969,6 +5969,8 @@
const intptr_t handler_pos = TokenPos();
OpenBlock(); // Start the catch block sequence.
current_block_->scope->AddLabel(end_catch_label);
+ const GrowableObjectArray& handler_types =
+ GrowableObjectArray::Handle(GrowableObjectArray::New());
while ((CurrentToken() == Token::kCATCH) || IsLiteral("on")) {
const intptr_t catch_pos = TokenPos();
CatchParamDesc exception_param;
@@ -6061,11 +6063,17 @@
catch_pos, Token::kIS, exception_var, exception_type);
current_block_->statements->Add(
new IfNode(catch_pos, type_cond_expr, catch_handler, NULL));
+ ASSERT(exception_type->type().IsInstantiated());
+ handler_types.Add(*exception_param.type);
} else {
// No exception type exists in the catch specifier so execute the
// catch handler code unconditionally.
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);
}
SequenceNode* catch_clause = CloseBlock();
@@ -6118,11 +6126,13 @@
new LoadLocalNode(handler_pos, catch_excp_var),
new LoadLocalNode(handler_pos, catch_trace_var)));
}
- CatchClauseNode* catch_block = new CatchClauseNode(handler_pos,
- catch_handler_list,
- context_var,
- catch_excp_var,
- catch_trace_var);
+ CatchClauseNode* catch_block =
+ new CatchClauseNode(handler_pos,
+ catch_handler_list,
+ Array::ZoneHandle(Array::MakeArray(handler_types)),
+ context_var,
+ catch_excp_var,
+ catch_trace_var);
// Now create the try/catch ast node and return it. If there is a label
// on the try/catch, close the block that's embedding the try statement
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698