OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // TODO(jmesserly): this file needs to be refactored, it's a port from | 5 // TODO(jmesserly): this file needs to be refactored, it's a port from |
6 // package:dev_compiler's tests | 6 // package:dev_compiler's tests |
7 library analyzer.test.src.task.strong.strong_test_helper; | 7 library analyzer.test.src.task.strong.strong_test_helper; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 var source = unit.source; | 94 var source = unit.source; |
95 if (source.uri.scheme == 'dart') continue; | 95 if (source.uri.scheme == 'dart') continue; |
96 | 96 |
97 var librarySource = context.getLibrariesContaining(source).single; | 97 var librarySource = context.getLibrariesContaining(source).single; |
98 var resolved = context.resolveCompilationUnit2(source, librarySource); | 98 var resolved = context.resolveCompilationUnit2(source, librarySource); |
99 | 99 |
100 errors.addAll(context.computeErrors(source).where((e) => | 100 errors.addAll(context.computeErrors(source).where((e) => |
101 // TODO(jmesserly): these are usually intentional dynamic calls. | 101 // TODO(jmesserly): these are usually intentional dynamic calls. |
102 e.errorCode.name != 'UNDEFINED_METHOD' && | 102 e.errorCode.name != 'UNDEFINED_METHOD' && |
103 // We don't care about any of these: | 103 // We don't care about any of these: |
104 e.errorCode != HintCode.UNNECESSARY_CAST && | |
105 e.errorCode != HintCode.UNUSED_ELEMENT && | 104 e.errorCode != HintCode.UNUSED_ELEMENT && |
106 e.errorCode != HintCode.UNUSED_FIELD && | 105 e.errorCode != HintCode.UNUSED_FIELD && |
107 e.errorCode != HintCode.UNUSED_IMPORT && | 106 e.errorCode != HintCode.UNUSED_IMPORT && |
108 e.errorCode != HintCode.UNUSED_LOCAL_VARIABLE && | 107 e.errorCode != HintCode.UNUSED_LOCAL_VARIABLE && |
109 e.errorCode != TodoCode.TODO)); | 108 e.errorCode != TodoCode.TODO)); |
110 _expectErrors(context, resolved, errors); | 109 _expectErrors(context, resolved, errors); |
111 } | 110 } |
112 } | 111 } |
113 | 112 |
114 return initialLibrary; | 113 return initialLibrary; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 398 |
400 @override | 399 @override |
401 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 400 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
402 if (uri.scheme == 'package') { | 401 if (uri.scheme == 'package') { |
403 return (provider.getResource('/packages/' + uri.path) as File) | 402 return (provider.getResource('/packages/' + uri.path) as File) |
404 .createSource(uri); | 403 .createSource(uri); |
405 } | 404 } |
406 return super.resolveAbsolute(uri, actualUri); | 405 return super.resolveAbsolute(uri, actualUri); |
407 } | 406 } |
408 } | 407 } |
OLD | NEW |