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

Side by Side Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 686113007: Report HintCode.UNUSED_LOCAL_VARIABLE for local variables whose value is never used. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « no previous file | pkg/analyzer/lib/src/generated/element.dart » ('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) 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 test.services.correction.fix; 5 library test.services.correction.fix;
6 6
7 import 'package:analysis_server/src/protocol.dart' hide AnalysisError; 7 import 'package:analysis_server/src/protocol.dart' hide AnalysisError;
8 import 'package:analysis_server/src/services/correction/fix.dart'; 8 import 'package:analysis_server/src/services/correction/fix.dart';
9 import 'package:analysis_server/src/services/index/index.dart'; 9 import 'package:analysis_server/src/services/index/index.dart';
10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; 10 import 'package:analysis_server/src/services/index/local_memory_index.dart';
(...skipping 2286 matching lines...) Expand 10 before | Expand all | Expand 10 after
2297 'my_pkg': [myPkgFolder] 2297 'my_pkg': [myPkgFolder]
2298 }); 2298 });
2299 context.sourceFactory = new SourceFactory( 2299 context.sourceFactory = new SourceFactory(
2300 [AbstractContextTest.SDK_RESOLVER, resourceResolver, pkgResolver]); 2300 [AbstractContextTest.SDK_RESOLVER, resourceResolver, pkgResolver]);
2301 // force 'my_pkg' resolution 2301 // force 'my_pkg' resolution
2302 addSource('/tmp/other.dart', "import 'package:my_pkg/my_lib.dart';"); 2302 addSource('/tmp/other.dart', "import 'package:my_pkg/my_lib.dart';");
2303 } 2303 }
2304 2304
2305 AnalysisError _findErrorToFix() { 2305 AnalysisError _findErrorToFix() {
2306 List<AnalysisError> errors = context.computeErrors(testSource); 2306 List<AnalysisError> errors = context.computeErrors(testSource);
2307 errors.removeWhere((error) {
2308 return error.errorCode == HintCode.UNUSED_LOCAL_VARIABLE;
2309 });
2307 if (checkHasSingleError) { 2310 if (checkHasSingleError) {
2308 expect(errors, hasLength(1)); 2311 expect(errors, hasLength(1));
2309 } 2312 }
2310 return errors[0]; 2313 return errors[0];
2311 } 2314 }
2312 2315
2313 List<Position> _findResultPositions(List<String> searchStrings) { 2316 List<Position> _findResultPositions(List<String> searchStrings) {
2314 List<Position> positions = <Position>[]; 2317 List<Position> positions = <Position>[];
2315 for (String search in searchStrings) { 2318 for (String search in searchStrings) {
2316 int offset = resultCode.indexOf(search); 2319 int offset = resultCode.indexOf(search);
2317 int length = getLeadingIdentifierLength(search); 2320 int length = getLeadingIdentifierLength(search);
2318 positions.add(new Position(testFile, offset)); 2321 positions.add(new Position(testFile, offset));
2319 } 2322 }
2320 return positions; 2323 return positions;
2321 } 2324 }
2322 2325
2323 void _indexTestUnit(String code) { 2326 void _indexTestUnit(String code) {
2324 resolveTestUnit(code); 2327 resolveTestUnit(code);
2325 index.indexUnit(context, testUnit); 2328 index.indexUnit(context, testUnit);
2326 } 2329 }
2327 } 2330 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698