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 test.src.task.strong.strong_test_helper; | 7 library test.src.task.strong.strong_test_helper; |
8 | 8 |
9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 if (key.startsWith(scheme)) { | 56 if (key.startsWith(scheme)) { |
57 key = '/packages/${key.substring(scheme.length)}'; | 57 key = '/packages/${key.substring(scheme.length)}'; |
58 } | 58 } |
59 provider.newFile(key, value); | 59 provider.newFile(key, value); |
60 }); | 60 }); |
61 var uriResolver = new TestUriResolver(provider); | 61 var uriResolver = new TestUriResolver(provider); |
62 // Enable task model strong mode | 62 // Enable task model strong mode |
63 AnalysisEngine.instance.useTaskModel = true; | 63 AnalysisEngine.instance.useTaskModel = true; |
64 var context = AnalysisEngine.instance.createAnalysisContext(); | 64 var context = AnalysisEngine.instance.createAnalysisContext(); |
65 context.analysisOptions.strongMode = true; | 65 context.analysisOptions.strongMode = true; |
| 66 context.analysisOptions.strongModeHints = true; |
66 | 67 |
67 context.sourceFactory = new SourceFactory([ | 68 context.sourceFactory = new SourceFactory([ |
68 new MockDartSdk(mockSdkSources, reportMissing: true).resolver, | 69 new MockDartSdk(mockSdkSources, reportMissing: true).resolver, |
69 uriResolver | 70 uriResolver |
70 ]); | 71 ]); |
71 | 72 |
72 // Run the checker on /main.dart. | 73 // Run the checker on /main.dart. |
73 Source mainSource = uriResolver.resolveAbsolute(new Uri.file('/main.dart')); | 74 Source mainSource = uriResolver.resolveAbsolute(new Uri.file('/main.dart')); |
74 var initialLibrary = | 75 var initialLibrary = |
75 context.resolveCompilationUnit2(mainSource, mainSource); | 76 context.resolveCompilationUnit2(mainSource, mainSource); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 if (levelName == 'warning') return _MAGENTA_COLOR; | 504 if (levelName == 'warning') return _MAGENTA_COLOR; |
504 if (levelName == 'info') return _CYAN_COLOR; | 505 if (levelName == 'info') return _CYAN_COLOR; |
505 return null; | 506 return null; |
506 } | 507 } |
507 | 508 |
508 const String _RED_COLOR = '\u001b[31m'; | 509 const String _RED_COLOR = '\u001b[31m'; |
509 const String _MAGENTA_COLOR = '\u001b[35m'; | 510 const String _MAGENTA_COLOR = '\u001b[35m'; |
510 const String _CYAN_COLOR = '\u001b[36m'; | 511 const String _CYAN_COLOR = '\u001b[36m'; |
511 const String GREEN_COLOR = '\u001b[32m'; | 512 const String GREEN_COLOR = '\u001b[32m'; |
512 const String NO_COLOR = '\u001b[0m'; | 513 const String NO_COLOR = '\u001b[0m'; |
OLD | NEW |