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

Unified Diff: runtime/vm/parser.cc

Issue 22909032: Fix allocation of indices for try-blocks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 26513)
+++ runtime/vm/parser.cc (working copy)
@@ -255,7 +255,7 @@
current_class_(Class::Handle(isolate_)),
library_(Library::Handle(isolate_, library.raw())),
try_blocks_list_(NULL),
- last_used_try_index_(CatchClauseNode::kInvalidTryIndex),
+ last_used_try_index_(0),
unregister_pending_function_(false) {
ASSERT(tokens_iterator_.IsValid());
ASSERT(!library.IsNull());
@@ -285,7 +285,7 @@
isolate_,
parsed_function->function().origin()).library())),
try_blocks_list_(NULL),
- last_used_try_index_(CatchClauseNode::kInvalidTryIndex),
+ last_used_try_index_(0),
unregister_pending_function_(false) {
ASSERT(tokens_iterator_.IsValid());
ASSERT(!current_function().IsNull());
@@ -2646,11 +2646,16 @@
Function::Handle(innermost_function().raw());
innermost_function_ = func.raw();
+ // Save current try index. Try index starts at zero for each function.
+ intptr_t saved_try_index = last_used_try_index_;
+ last_used_try_index_ = 0;
+
// TODO(12455) : Need better validation mechanism.
if (func.IsConstructor()) {
SequenceNode* statements = ParseConstructor(func, default_parameter_values);
innermost_function_ = saved_innermost_function.raw();
+ last_used_try_index_ = saved_try_index;
return statements;
}
@@ -2760,6 +2765,7 @@
SequenceNode* body = CloseBlock();
current_block_->statements->Add(body);
innermost_function_ = saved_innermost_function.raw();
+ last_used_try_index_ = saved_try_index;
return CloseBlock();
}

Powered by Google App Engine
This is Rietveld 408576698