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

Side by Side 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, 5 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library analyzer.test.generated.all_the_rest_test; 5 library analyzer.test.generated.all_the_rest_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
(...skipping 3469 matching lines...) Expand 10 before | Expand all | Expand 10 after
3480 } 3480 }
3481 3481
3482 void test_doStatement_return() { 3482 void test_doStatement_return() {
3483 _assertTrue("{ do { return null; } while (1 == 2); }"); 3483 _assertTrue("{ do { return null; } while (1 == 2); }");
3484 } 3484 }
3485 3485
3486 void test_doStatement_throwCondition() { 3486 void test_doStatement_throwCondition() {
3487 _assertTrue("{ do {} while (throw ''); }"); 3487 _assertTrue("{ do {} while (throw ''); }");
3488 } 3488 }
3489 3489
3490 void test_doStatement_break_and_throw() {
3491 _assertFalse("{ do { if (1==1) break; throw 'T'; } while (0==1); }");
3492 }
3493
3494 void test_doStatement_continue_and_throw() {
3495 _assertFalse("{ do { if (1==1) continue; throw 'T'; } while (0==1); }");
3496 }
3497
3498 void test_doStatement_continueInSwitch_and_throw() {
3499 _assertFalse('''
3500 {
3501 do {
3502 switch (1) {
3503 L: case 0: continue;
3504 M: case 1: break;
3505 }
3506 throw 'T';
3507 } while (0 == 1);
3508 }''');
3509 }
3510
3511 void test_doStatement_continueDoInSwitch_and_throw() {
3512 _assertFalse('''
3513 {
3514 D: do {
3515 switch (1) {
3516 L: case 0: continue D;
3517 M: case 1: break;
3518 }
3519 throw 'T';
3520 } while (0 == 1);
3521 }''');
3522 }
3523
3490 void test_doStatement_true_break() { 3524 void test_doStatement_true_break() {
3491 _assertFalse("{ do { break; } while (true); }"); 3525 _assertFalse("{ do { break; } while (true); }");
3492 } 3526 }
3493 3527
3494 void test_doStatement_true_continue() { 3528 void test_doStatement_true_continue() {
3495 _assertTrue("{ do { continue; } while (true); }"); 3529 _assertTrue("{ do { continue; } while (true); }");
3496 } 3530 }
3497 3531
3498 void test_doStatement_true_if_return() { 3532 void test_doStatement_true_if_return() {
3499 _assertTrue("{ do { if (true) {return null;} } while (true); }"); 3533 _assertTrue("{ do { if (true) {return null;} } while (true); }");
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
3752 } 3786 }
3753 3787
3754 void test_switch_fallThroughToNotReturn() { 3788 void test_switch_fallThroughToNotReturn() {
3755 _assertFalse("switch (i) { case 0: case 1: break; default: return 1; }"); 3789 _assertFalse("switch (i) { case 0: case 1: break; default: return 1; }");
3756 } 3790 }
3757 3791
3758 void test_switch_fallThroughToReturn() { 3792 void test_switch_fallThroughToReturn() {
3759 _assertTrue("switch (i) { case 0: case 1: return 0; default: return 1; }"); 3793 _assertTrue("switch (i) { case 0: case 1: return 0; default: return 1; }");
3760 } 3794 }
3761 3795
3796 // The ExitDetector could conceivably follow switch continue labels and
3797 // determine that `case 0` exits, `case 1` continues to an exiting case, and
3798 // `default` exits, so the switch exits.
3799 @failingTest
3800 void test_switch_includesContinue() {
3801 _assertTrue('''
3802 switch (i) {
3803 zero: case 0: return 0;
3804 case 1: continue zero;
3805 default: return 1;
3806 }''');
3807 }
3808
3762 void test_switch_noDefault() { 3809 void test_switch_noDefault() {
3763 _assertFalse("switch (i) { case 0: return 0; }"); 3810 _assertFalse("switch (i) { case 0: return 0; }");
3764 } 3811 }
3765 3812
3766 void test_switch_nonReturn() { 3813 void test_switch_nonReturn() {
3767 _assertFalse("switch (i) { case 0: i++; default: return 1; }"); 3814 _assertFalse("switch (i) { case 0: i++; default: return 1; }");
3768 } 3815 }
3769 3816
3770 void test_thisExpression() { 3817 void test_thisExpression() {
3771 _assertFalse("this.a;"); 3818 _assertFalse("this.a;");
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
4460 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); 4507 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI));
4461 expect(UriKind.fromEncoding(0x58), same(null)); 4508 expect(UriKind.fromEncoding(0x58), same(null));
4462 } 4509 }
4463 4510
4464 void test_getEncoding() { 4511 void test_getEncoding() {
4465 expect(UriKind.DART_URI.encoding, 0x64); 4512 expect(UriKind.DART_URI.encoding, 0x64);
4466 expect(UriKind.FILE_URI.encoding, 0x66); 4513 expect(UriKind.FILE_URI.encoding, 0x66);
4467 expect(UriKind.PACKAGE_URI.encoding, 0x70); 4514 expect(UriKind.PACKAGE_URI.encoding, 0x70);
4468 } 4515 }
4469 } 4516 }
OLDNEW
« 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