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

Side by Side Diff: frog/tests/leg_only/src/LabelTest.dart

Issue 9421035: Support break and labeled statements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Update expectations. 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 | « frog/leg/typechecker.dart ('k') | tests/co19/co19-leg.status » ('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 // A break label must be declared where it's used. 5 // A break label must be declared where it's used.
6 undeclaredBreakLabel1() { 6 undeclaredBreakLabel1() {
7 foo: { break bar; break foo; } /// 01: compile-time error 7 foo: { break bar; break foo; } /// 01: compile-time error
8 } 8 }
9 9
10 undeclaredBreakLabel2() { 10 undeclaredBreakLabel2() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // Implicit break targets are not captured by closures. 42 // Implicit break targets are not captured by closures.
43 noncaptureBreak() { 43 noncaptureBreak() {
44 while(true) (() { break; })(); /// 08: compile-time error 44 while(true) (() { break; })(); /// 08: compile-time error
45 } 45 }
46 46
47 // Implicit continue targets are not captured by closures. 47 // Implicit continue targets are not captured by closures.
48 noncaptureContinue() { 48 noncaptureContinue() {
49 while(true) (() { continue; })(); /// 09: compile-time error 49 while(true) (() { continue; })(); /// 09: compile-time error
50 } 50 }
51 51
52 // Duplicate labels are reported as a warning only.
53 duplicateLabels() {
54 foo: { /// 10: compile-time error
55 foo: { /// 10: continued
56 return; /// 10: continued
57 break foo; /// 10: continued
58 } /// 10: continued
59 } /// 10: continued
60 }
61
62
63 // Unused labels are reported as a warning only.
64 unusedLabels() {
65 foo: { return; } /// 11: compile-time error
66 }
67
68
69 main() { 52 main() {
70 undeclaredBreakLabel1(); 53 undeclaredBreakLabel1();
71 undeclaredBreakLabel2(); 54 undeclaredBreakLabel2();
72 noBreakTarget(); 55 noBreakTarget();
73 undeclaredContinueLabel(); 56 undeclaredContinueLabel();
74 noContinueTarget(); 57 noContinueTarget();
75 wrongContinueLabel(); 58 wrongContinueLabel();
76 noncaptureLabel(); 59 noncaptureLabel();
77 noncaptureBreak(); 60 noncaptureBreak();
78 noncaptureContinue(); 61 noncaptureContinue();
79 duplicateLabels();
80 unusedLabels();
81 } 62 }
OLDNEW
« no previous file with comments | « frog/leg/typechecker.dart ('k') | tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698