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 'dart:async'; | 9 import 'dart:async'; |
10 | 10 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 /// errors/warnings/hints match the expected value. | 266 /// errors/warnings/hints match the expected value. |
267 /// | 267 /// |
268 /// See [addFile] for more information about how to encode expectations in | 268 /// See [addFile] for more information about how to encode expectations in |
269 /// the file text. | 269 /// the file text. |
270 /// | 270 /// |
271 /// Returns the main resolved library. This can be used for further checks. | 271 /// Returns the main resolved library. This can be used for further checks. |
272 Future<CompilationUnit> check( | 272 Future<CompilationUnit> check( |
273 {bool declarationCasts: true, | 273 {bool declarationCasts: true, |
274 bool implicitCasts: true, | 274 bool implicitCasts: true, |
275 bool implicitDynamic: true, | 275 bool implicitDynamic: true, |
276 List<String> nonnullableTypes: | 276 List<String> nonnullableTypes: AnalysisOptionsImpl.NONNULLABLE_TYPES, |
277 AnalysisOptionsImpl.NONNULLABLE_TYPES}) async { | 277 bool superMixins: false}) async { |
278 _checkCalled = true; | 278 _checkCalled = true; |
279 | 279 |
280 File mainFile = | 280 File mainFile = |
281 _resourceProvider.getFile(_resourceProvider.convertPath('/main.dart')); | 281 _resourceProvider.getFile(_resourceProvider.convertPath('/main.dart')); |
282 expect(mainFile.exists, true, reason: '`/main.dart` is missing'); | 282 expect(mainFile.exists, true, reason: '`/main.dart` is missing'); |
283 | 283 |
284 AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl(); | 284 AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl(); |
285 analysisOptions.strongMode = true; | 285 analysisOptions.strongMode = true; |
286 analysisOptions.strongModeHints = true; | 286 analysisOptions.strongModeHints = true; |
287 analysisOptions.declarationCasts = declarationCasts; | 287 analysisOptions.declarationCasts = declarationCasts; |
288 analysisOptions.implicitCasts = implicitCasts; | 288 analysisOptions.implicitCasts = implicitCasts; |
289 analysisOptions.implicitDynamic = implicitDynamic; | 289 analysisOptions.implicitDynamic = implicitDynamic; |
290 analysisOptions.nonnullableTypes = nonnullableTypes; | 290 analysisOptions.nonnullableTypes = nonnullableTypes; |
| 291 analysisOptions.enableSuperMixins = superMixins; |
291 | 292 |
292 var mockSdk = new MockSdk(resourceProvider: _resourceProvider); | 293 var mockSdk = new MockSdk(resourceProvider: _resourceProvider); |
293 mockSdk.context.analysisOptions = analysisOptions; | 294 mockSdk.context.analysisOptions = analysisOptions; |
294 | 295 |
295 SourceFactory sourceFactory; | 296 SourceFactory sourceFactory; |
296 { | 297 { |
297 var uriResolver = new _TestUriResolver(_resourceProvider); | 298 var uriResolver = new _TestUriResolver(_resourceProvider); |
298 sourceFactory = | 299 sourceFactory = |
299 new SourceFactory([new DartUriResolver(mockSdk), uriResolver]); | 300 new SourceFactory([new DartUriResolver(mockSdk), uriResolver]); |
300 } | 301 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 @override | 475 @override |
475 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 476 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
476 if (uri.scheme == 'package') { | 477 if (uri.scheme == 'package') { |
477 return (provider.getResource( | 478 return (provider.getResource( |
478 provider.convertPath('/packages/' + uri.path)) as File) | 479 provider.convertPath('/packages/' + uri.path)) as File) |
479 .createSource(uri); | 480 .createSource(uri); |
480 } | 481 } |
481 return super.resolveAbsolute(uri, actualUri); | 482 return super.resolveAbsolute(uri, actualUri); |
482 } | 483 } |
483 } | 484 } |
OLD | NEW |