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

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

Issue 9347032: Fix issue 1246 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/scopes.h ('k') | tests/language/src/ContinueTest.dart » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/ast.h" 7 #include "vm/ast.h"
8 #include "vm/object.h" 8 #include "vm/object.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 SourceLabel* label = current_scope->LocalLookupLabel(name); 267 SourceLabel* label = current_scope->LocalLookupLabel(name);
268 if (label != NULL) { 268 if (label != NULL) {
269 return label; 269 return label;
270 } 270 }
271 current_scope = current_scope->parent(); 271 current_scope = current_scope->parent();
272 } 272 }
273 return NULL; 273 return NULL;
274 } 274 }
275 275
276 276
277 SourceLabel* LocalScope::LookupInnermostLabel() { 277 SourceLabel* LocalScope::LookupInnermostLabel(Token::Kind jump_kind) {
278 ASSERT((jump_kind == Token::kCONTINUE) || (jump_kind == Token::kBREAK));
278 LocalScope* current_scope = this; 279 LocalScope* current_scope = this;
279 while (current_scope != NULL) { 280 while (current_scope != NULL) {
280 for (intptr_t i = 0; i < current_scope->labels_.length(); i++) { 281 for (intptr_t i = 0; i < current_scope->labels_.length(); i++) {
281 SourceLabel* label = current_scope->labels_[i]; 282 SourceLabel* label = current_scope->labels_[i];
282 if (label->kind() == SourceLabel::kWhile || 283 if ((label->kind() == SourceLabel::kWhile) ||
283 label->kind() == SourceLabel::kFor || 284 (label->kind() == SourceLabel::kFor) ||
284 label->kind() == SourceLabel::kDoWhile || 285 (label->kind() == SourceLabel::kDoWhile) ||
285 label->kind() == SourceLabel::kSwitch) { 286 ((jump_kind == Token::kBREAK) &&
287 (label->kind() == SourceLabel::kSwitch))) {
286 return label; 288 return label;
287 } 289 }
288 } 290 }
289 current_scope = current_scope->parent(); 291 current_scope = current_scope->parent();
290 } 292 }
291 return NULL; 293 return NULL;
292 } 294 }
293 295
294 296
295 SourceLabel* LocalScope::LookupInnermostCatchLabel() { 297 SourceLabel* LocalScope::LookupInnermostCatchLabel() {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 } 463 }
462 if (owner()->context_level() == other.owner()->context_level()) { 464 if (owner()->context_level() == other.owner()->context_level()) {
463 return true; 465 return true;
464 } 466 }
465 } 467 }
466 } 468 }
467 return false; 469 return false;
468 } 470 }
469 471
470 } // namespace dart 472 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scopes.h ('k') | tests/language/src/ContinueTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698