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

Unified Diff: pkg/analyzer/test/generated/all_the_rest_test.dart

Issue 2102223002: ExitDetector: Examine continue when determining a 'do' (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: One failing test Created 4 years, 6 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 | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/all_the_rest_test.dart
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index f9c4c8bf96e37fbd8ca616b3b22884d0303c8043..1432fea9d659f9e76cc585bdc14ce3aeef5280ba 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -3487,6 +3487,40 @@ class ExitDetectorTest extends ParserTestCase {
_assertTrue("{ do {} while (throw ''); }");
}
+ void test_doStatement_break_and_throw() {
+ _assertFalse("{ do { if (1==1) break; throw 'T'; } while (0==1); }");
+ }
+
+ void test_doStatement_continue_and_throw() {
+ _assertFalse("{ do { if (1==1) continue; throw 'T'; } while (0==1); }");
+ }
+
+ void test_doStatement_continueInSwitch_and_throw() {
+ _assertFalse('''
+{
+ do {
+ switch (1) {
+ L: case 0: continue;
+ M: case 1: break;
+ }
+ throw 'T';
+ } while (0 == 1);
+}''');
+ }
+
+ void test_doStatement_continueDoInSwitch_and_throw() {
+ _assertFalse('''
+{
+ D: do {
+ switch (1) {
+ L: case 0: continue D;
+ M: case 1: break;
+ }
+ throw 'T';
+ } while (0 == 1);
+}''');
+ }
+
void test_doStatement_true_break() {
_assertFalse("{ do { break; } while (true); }");
}
@@ -3759,6 +3793,19 @@ class ExitDetectorTest extends ParserTestCase {
_assertTrue("switch (i) { case 0: case 1: return 0; default: return 1; }");
}
+ // The ExitDetector could conceivably follow switch continue labels and
+ // determine that `case 0` exits, `case 1` continues to an exiting case, and
+ // `default` exits, so the switch exits.
+ @failingTest
+ void test_switch_includesContinue() {
+ _assertTrue('''
+switch (i) {
+ zero: case 0: return 0;
+ case 1: continue zero;
+ default: return 1;
+}''');
+ }
+
void test_switch_noDefault() {
_assertFalse("switch (i) { case 0: return 0; }");
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698