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

Side by Side Diff: pkg/analyzer/test/generated/all_the_rest_test.dart

Issue 2033693003: ExitDetector: Do not special case enums, since null exists (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 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 3898 matching lines...) Expand 10 before | Expand all | Expand 10 after
3909 enum E { A, B } 3909 enum E { A, B }
3910 String f(E e) { 3910 String f(E e) {
3911 switch (e) { 3911 switch (e) {
3912 case A: 3912 case A:
3913 return 'A'; 3913 return 'A';
3914 case B: 3914 case B:
3915 return 'B'; 3915 return 'B';
3916 } 3916 }
3917 } 3917 }
3918 '''); 3918 ''');
3919 _assertNthStatementExits(source, 0); 3919 _assertNthStatementDoesNotExit(source, 0);
3920 } 3920 }
3921 3921
3922 void test_switch_withEnum_true_withDefault() { 3922 void test_switch_withEnum_true_withExitingDefault() {
3923 Source source = addSource(r''' 3923 Source source = addSource(r'''
3924 enum E { A, B } 3924 enum E { A, B }
3925 String f(E e) { 3925 String f(E e) {
3926 switch (e) { 3926 switch (e) {
3927 case A: 3927 case A:
3928 return 'A'; 3928 return 'A';
3929 default: 3929 default:
3930 return '?'; 3930 return '?';
3931 } 3931 }
3932 } 3932 }
3933 '''); 3933 ''');
3934 _assertNthStatementExits(source, 0); 3934 _assertNthStatementExits(source, 0);
3935 } 3935 }
3936 3936
3937 void test_switch_withEnum_true_withNonExitingDefault() {
3938 Source source = addSource(r'''
3939 enum E { A, B }
3940 String f(E e) {
3941 var x;
3942 switch (e) {
3943 case A:
3944 return 'A';
3945 default:
3946 x = '?';
3947 }
3948 }
3949 ''');
3950 _assertNthStatementDoesNotExit(source, 1);
3951 }
3952
3937 void test_whileStatement_breakWithLabel() { 3953 void test_whileStatement_breakWithLabel() {
3938 Source source = addSource(r''' 3954 Source source = addSource(r'''
3939 void f() { 3955 void f() {
3940 x: while (true) { 3956 x: while (true) {
3941 if (1 < 2) { 3957 if (1 < 2) {
3942 break x; 3958 break x;
3943 } 3959 }
3944 return; 3960 return;
3945 } 3961 }
3946 } 3962 }
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
4391 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI)); 4407 expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI));
4392 expect(UriKind.fromEncoding(0x58), same(null)); 4408 expect(UriKind.fromEncoding(0x58), same(null));
4393 } 4409 }
4394 4410
4395 void test_getEncoding() { 4411 void test_getEncoding() {
4396 expect(UriKind.DART_URI.encoding, 0x64); 4412 expect(UriKind.DART_URI.encoding, 0x64);
4397 expect(UriKind.FILE_URI.encoding, 0x66); 4413 expect(UriKind.FILE_URI.encoding, 0x66);
4398 expect(UriKind.PACKAGE_URI.encoding, 0x70); 4414 expect(UriKind.PACKAGE_URI.encoding, 0x70);
4399 } 4415 }
4400 } 4416 }
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