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

Side by Side Diff: runtime/vm/scopes.cc

Issue 63983005: Simplify the desugaring of catch clauses. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated final review comments. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/scopes.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/scopes.h" 5 #include "vm/scopes.h"
6 6
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/stack_frame.h" 8 #include "vm/stack_frame.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 10
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 (label->kind() == SourceLabel::kSwitch))) { 432 (label->kind() == SourceLabel::kSwitch))) {
433 return label; 433 return label;
434 } 434 }
435 } 435 }
436 current_scope = current_scope->parent(); 436 current_scope = current_scope->parent();
437 } 437 }
438 return NULL; 438 return NULL;
439 } 439 }
440 440
441 441
442 SourceLabel* LocalScope::LookupInnermostCatchLabel() {
443 LocalScope* current_scope = this;
444 while (current_scope != NULL) {
445 for (intptr_t i = 0; i < current_scope->labels_.length(); i++) {
446 SourceLabel* label = current_scope->labels_[i];
447 if (label->kind() == SourceLabel::kCatch) {
448 return label;
449 }
450 }
451 current_scope = current_scope->parent();
452 }
453 return NULL;
454 }
455
456
457 LocalScope* LocalScope::LookupSwitchScope() { 442 LocalScope* LocalScope::LookupSwitchScope() {
458 LocalScope* current_scope = this->parent(); 443 LocalScope* current_scope = this->parent();
459 int this_level = this->function_level(); 444 int this_level = this->function_level();
460 while (current_scope != NULL && 445 while (current_scope != NULL &&
461 current_scope->function_level() == this_level) { 446 current_scope->function_level() == this_level) {
462 for (int i = 0; i < current_scope->labels_.length(); i++) { 447 for (int i = 0; i < current_scope->labels_.length(); i++) {
463 SourceLabel* label = current_scope->labels_[i]; 448 SourceLabel* label = current_scope->labels_[i];
464 if (label->kind() == SourceLabel::kSwitch) { 449 if (label->kind() == SourceLabel::kSwitch) {
465 // This scope contains a label that is bound to a switch statement, 450 // This scope contains a label that is bound to a switch statement,
466 // so it is the scope of the a statement body. 451 // so it is the scope of the a statement body.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 return fixed_parameter_count - (index() - kParamEndSlotFromFp); 625 return fixed_parameter_count - (index() - kParamEndSlotFromFp);
641 } else { 626 } else {
642 // Shift negative indexes so that the lowest one is 0 (they are still 627 // Shift negative indexes so that the lowest one is 0 (they are still
643 // non-positive). 628 // non-positive).
644 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); 629 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp);
645 } 630 }
646 } 631 }
647 632
648 633
649 } // namespace dart 634 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scopes.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698