OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:analyzer/dart/element/element.dart'; | 5 import 'package:analyzer/dart/element/element.dart'; |
6 import 'package:analyzer/dart/element/visitor.dart'; | 6 import 'package:analyzer/dart/element/visitor.dart'; |
7 import 'package:analyzer/file_system/file_system.dart'; | 7 import 'package:analyzer/file_system/file_system.dart'; |
8 import 'package:analyzer/file_system/memory_file_system.dart'; | 8 import 'package:analyzer/file_system/memory_file_system.dart'; |
9 import 'package:analyzer/source/package_map_resolver.dart'; | 9 import 'package:analyzer/source/package_map_resolver.dart'; |
10 import 'package:analyzer/src/dart/analysis/byte_store.dart'; | 10 import 'package:analyzer/src/dart/analysis/byte_store.dart'; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 AnalysisDriverScheduler scheduler; | 56 AnalysisDriverScheduler scheduler; |
57 AnalysisDriver driver; | 57 AnalysisDriver driver; |
58 final List<AnalysisStatus> allStatuses = <AnalysisStatus>[]; | 58 final List<AnalysisStatus> allStatuses = <AnalysisStatus>[]; |
59 final List<AnalysisResult> allResults = <AnalysisResult>[]; | 59 final List<AnalysisResult> allResults = <AnalysisResult>[]; |
60 final List<ExceptionResult> allExceptions = <ExceptionResult>[]; | 60 final List<ExceptionResult> allExceptions = <ExceptionResult>[]; |
61 | 61 |
62 String testProject; | 62 String testProject; |
63 String testFile; | 63 String testFile; |
64 String testCode; | 64 String testCode; |
65 | 65 |
| 66 bool get disableChangesAndCacheAllResults => false; |
| 67 |
66 void addTestFile(String content, {bool priority: false}) { | 68 void addTestFile(String content, {bool priority: false}) { |
67 testCode = content; | 69 testCode = content; |
68 provider.newFile(testFile, content); | 70 provider.newFile(testFile, content); |
69 driver.addFile(testFile); | 71 driver.addFile(testFile); |
70 if (priority) { | 72 if (priority) { |
71 driver.priorityFiles = [testFile]; | 73 driver.priorityFiles = [testFile]; |
72 } | 74 } |
73 } | 75 } |
74 | 76 |
75 int findOffset(String search) { | 77 int findOffset(String search) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 new SourceFactory([ | 119 new SourceFactory([ |
118 new DartUriResolver(sdk), | 120 new DartUriResolver(sdk), |
119 generatedUriResolver, | 121 generatedUriResolver, |
120 new PackageMapUriResolver(provider, <String, List<Folder>>{ | 122 new PackageMapUriResolver(provider, <String, List<Folder>>{ |
121 'test': [provider.getFolder(testProject)] | 123 'test': [provider.getFolder(testProject)] |
122 }), | 124 }), |
123 new ResourceUriResolver(provider) | 125 new ResourceUriResolver(provider) |
124 ], null, provider), | 126 ], null, provider), |
125 new AnalysisOptionsImpl() | 127 new AnalysisOptionsImpl() |
126 ..strongMode = true | 128 ..strongMode = true |
127 ..enableUriInPartOf = true); | 129 ..enableUriInPartOf = true, |
| 130 disableChangesAndCacheAllResults: disableChangesAndCacheAllResults); |
128 scheduler.start(); | 131 scheduler.start(); |
129 scheduler.status.listen(allStatuses.add); | 132 scheduler.status.listen(allStatuses.add); |
130 driver.results.listen(allResults.add); | 133 driver.results.listen(allResults.add); |
131 driver.exceptions.listen(allExceptions.add); | 134 driver.exceptions.listen(allExceptions.add); |
132 } | 135 } |
133 | 136 |
134 String _p(String path) => provider.convertPath(path); | 137 String _p(String path) => provider.convertPath(path); |
135 } | 138 } |
136 | 139 |
137 /** | 140 /** |
138 * Wraps an [_ElementVisitorFunction] into a [GeneralizingElementVisitor]. | 141 * Wraps an [_ElementVisitorFunction] into a [GeneralizingElementVisitor]. |
139 */ | 142 */ |
140 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { | 143 class _ElementVisitorFunctionWrapper extends GeneralizingElementVisitor { |
141 final _ElementVisitorFunction function; | 144 final _ElementVisitorFunction function; |
142 | 145 |
143 _ElementVisitorFunctionWrapper(this.function); | 146 _ElementVisitorFunctionWrapper(this.function); |
144 | 147 |
145 visitElement(Element element) { | 148 visitElement(Element element) { |
146 function(element); | 149 function(element); |
147 super.visitElement(element); | 150 super.visitElement(element); |
148 } | 151 } |
149 } | 152 } |
150 | 153 |
151 class _GeneratedUriResolverMock extends TypedMock implements UriResolver {} | 154 class _GeneratedUriResolverMock extends TypedMock implements UriResolver {} |
OLD | NEW |