| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 var uriResolver = new _TestUriResolver(files); | 63 var uriResolver = new _TestUriResolver(files); |
| 64 // Enable task model strong mode | 64 // Enable task model strong mode |
| 65 var context = AnalysisEngine.instance.createAnalysisContext(); | 65 var context = AnalysisEngine.instance.createAnalysisContext(); |
| 66 AnalysisOptionsImpl options = context.analysisOptions as AnalysisOptionsImpl; | 66 AnalysisOptionsImpl options = context.analysisOptions as AnalysisOptionsImpl; |
| 67 options.strongMode = true; | 67 options.strongMode = true; |
| 68 options.strongModeHints = true; | 68 options.strongModeHints = true; |
| 69 options.implicitCasts = implicitCasts; | 69 options.implicitCasts = implicitCasts; |
| 70 options.implicitDynamic = implicitDynamic; | 70 options.implicitDynamic = implicitDynamic; |
| 71 var mockSdk = new MockSdk(); | 71 var mockSdk = new MockSdk(); |
| 72 mockSdk.context.analysisOptions.strongMode = true; | 72 (mockSdk.context.analysisOptions as AnalysisOptionsImpl).strongMode = true; |
| 73 context.sourceFactory = | 73 context.sourceFactory = |
| 74 new SourceFactory([new DartUriResolver(mockSdk), uriResolver]); | 74 new SourceFactory([new DartUriResolver(mockSdk), uriResolver]); |
| 75 | 75 |
| 76 // Run the checker on /main.dart. | 76 // Run the checker on /main.dart. |
| 77 Source mainSource = uriResolver.resolveAbsolute(new Uri.file('/main.dart')); | 77 Source mainSource = uriResolver.resolveAbsolute(new Uri.file('/main.dart')); |
| 78 var initialLibrary = context.resolveCompilationUnit2(mainSource, mainSource); | 78 var initialLibrary = context.resolveCompilationUnit2(mainSource, mainSource); |
| 79 | 79 |
| 80 var collector = new _ErrorCollector(context); | 80 var collector = new _ErrorCollector(context); |
| 81 | 81 |
| 82 // Extract expectations from the comments in the test files, and | 82 // Extract expectations from the comments in the test files, and |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 395 |
| 396 @override | 396 @override |
| 397 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 397 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 398 if (uri.scheme == 'package') { | 398 if (uri.scheme == 'package') { |
| 399 return (provider.getResource('/packages/' + uri.path) as File) | 399 return (provider.getResource('/packages/' + uri.path) as File) |
| 400 .createSource(uri); | 400 .createSource(uri); |
| 401 } | 401 } |
| 402 return super.resolveAbsolute(uri, actualUri); | 402 return super.resolveAbsolute(uri, actualUri); |
| 403 } | 403 } |
| 404 } | 404 } |
| OLD | NEW |