| 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'; |
| 11 import 'package:analyzer/dart/element/element.dart'; | 11 import 'package:analyzer/dart/element/element.dart'; |
| 12 import 'package:analyzer/error/error.dart'; |
| 13 import 'package:analyzer/error/listener.dart'; |
| 12 import 'package:analyzer/file_system/file_system.dart'; | 14 import 'package:analyzer/file_system/file_system.dart'; |
| 13 import 'package:analyzer/file_system/memory_file_system.dart'; | 15 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 14 import 'package:analyzer/source/error_processor.dart'; | 16 import 'package:analyzer/source/error_processor.dart'; |
| 15 import 'package:analyzer/src/dart/ast/token.dart'; | 17 import 'package:analyzer/src/dart/ast/token.dart'; |
| 18 import 'package:analyzer/src/error/codes.dart'; |
| 16 import 'package:analyzer/src/generated/engine.dart'; | 19 import 'package:analyzer/src/generated/engine.dart'; |
| 17 import 'package:analyzer/src/generated/error.dart'; | |
| 18 import 'package:analyzer/src/generated/source.dart'; | 20 import 'package:analyzer/src/generated/source.dart'; |
| 19 import 'package:source_span/source_span.dart'; | 21 import 'package:source_span/source_span.dart'; |
| 20 import 'package:unittest/unittest.dart'; | 22 import 'package:unittest/unittest.dart'; |
| 21 | 23 |
| 22 import '../../context/mock_sdk.dart'; | 24 import '../../context/mock_sdk.dart'; |
| 23 | 25 |
| 24 MemoryResourceProvider files; | 26 MemoryResourceProvider files; |
| 25 bool _checkCalled; | 27 bool _checkCalled; |
| 26 | 28 |
| 27 /// Adds a file to check. The file should contain: | 29 /// Adds a file to check. The file should contain: |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 List<LibraryElement> _reachableLibraries(LibraryElement start) { | 265 List<LibraryElement> _reachableLibraries(LibraryElement start) { |
| 264 var results = <LibraryElement>[]; | 266 var results = <LibraryElement>[]; |
| 265 var seen = new Set(); | 267 var seen = new Set(); |
| 266 void find(LibraryElement lib) { | 268 void find(LibraryElement lib) { |
| 267 if (seen.contains(lib)) return; | 269 if (seen.contains(lib)) return; |
| 268 seen.add(lib); | 270 seen.add(lib); |
| 269 results.add(lib); | 271 results.add(lib); |
| 270 lib.importedLibraries.forEach(find); | 272 lib.importedLibraries.forEach(find); |
| 271 lib.exportedLibraries.forEach(find); | 273 lib.exportedLibraries.forEach(find); |
| 272 } | 274 } |
| 275 |
| 273 find(start); | 276 find(start); |
| 274 return results; | 277 return results; |
| 275 } | 278 } |
| 276 | 279 |
| 277 void _reportFailure( | 280 void _reportFailure( |
| 278 AnalysisContext context, | 281 AnalysisContext context, |
| 279 CompilationUnit unit, | 282 CompilationUnit unit, |
| 280 List<_ErrorExpectation> unreported, | 283 List<_ErrorExpectation> unreported, |
| 281 List<AnalysisError> unexpected, | 284 List<AnalysisError> unexpected, |
| 282 Map<_ErrorExpectation, AnalysisError> different) { | 285 Map<_ErrorExpectation, AnalysisError> different) { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 401 |
| 399 @override | 402 @override |
| 400 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 403 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 401 if (uri.scheme == 'package') { | 404 if (uri.scheme == 'package') { |
| 402 return (provider.getResource('/packages/' + uri.path) as File) | 405 return (provider.getResource('/packages/' + uri.path) as File) |
| 403 .createSource(uri); | 406 .createSource(uri); |
| 404 } | 407 } |
| 405 return super.resolveAbsolute(uri, actualUri); | 408 return super.resolveAbsolute(uri, actualUri); |
| 406 } | 409 } |
| 407 } | 410 } |
| OLD | NEW |