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

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

Issue 1943443002: If an if or do statement always exits, following statements are dead. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: test_ prefixes Created 4 years, 7 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/test/generated/hint_code_test.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.non_hint_code_test; 5 library analyzer.test.generated.non_hint_code_test;
6 6
7 import 'package:analyzer/src/generated/error.dart'; 7 import 'package:analyzer/src/generated/error.dart';
8 import 'package:analyzer/src/generated/source_io.dart'; 8 import 'package:analyzer/src/generated/source_io.dart';
9 9
10 import '../reflective_tests.dart'; 10 import '../reflective_tests.dart';
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 Source source = addSource(r''' 151 Source source = addSource(r'''
152 const bool DEBUG = true; 152 const bool DEBUG = true;
153 f() { 153 f() {
154 bool b = DEBUG || true; 154 bool b = DEBUG || true;
155 }'''); 155 }''');
156 computeLibrarySourceErrors(source); 156 computeLibrarySourceErrors(source);
157 assertNoErrors(source); 157 assertNoErrors(source);
158 verify([source]); 158 verify([source]);
159 } 159 }
160 160
161 void test_deadCode_statementAfterIfWithoutElse() {
162 Source source = addSource(r'''
163 f() {
164 if (1 < 0) {
165 return;
166 }
167 int a = 1;
168 }''');
169 computeLibrarySourceErrors(source);
170 assertNoErrors(source);
171 verify([source]);
172 }
173
161 void test_deprecatedMemberUse_inDeprecatedClass() { 174 void test_deprecatedMemberUse_inDeprecatedClass() {
162 Source source = addSource(r''' 175 Source source = addSource(r'''
163 @deprecated 176 @deprecated
164 f() {} 177 f() {}
165 178
166 @deprecated 179 @deprecated
167 class C { 180 class C {
168 m() { 181 m() {
169 f(); 182 f();
170 } 183 }
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 1239
1227 void test_import_valid_outside_lib() { 1240 void test_import_valid_outside_lib() {
1228 cacheSource("/myproj/pubspec.yaml", ""); 1241 cacheSource("/myproj/pubspec.yaml", "");
1229 cacheSource("/myproj/web/other.dart", ""); 1242 cacheSource("/myproj/web/other.dart", "");
1230 Source source = 1243 Source source =
1231 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';"); 1244 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';");
1232 computeLibrarySourceErrors(source); 1245 computeLibrarySourceErrors(source);
1233 assertNoErrors(source); 1246 assertNoErrors(source);
1234 } 1247 }
1235 } 1248 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/hint_code_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698