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 | 2 |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import 'package:args/args.dart' show ArgParser, ArgResults; | 6 import 'package:args/args.dart' show ArgParser, ArgResults; |
7 import 'package:analyzer/src/context/context.dart' show AnalysisContextImpl; | 7 import 'package:analyzer/src/context/context.dart' show AnalysisContextImpl; |
8 import 'package:analyzer/src/generated/engine.dart' | 8 import 'package:analyzer/src/generated/engine.dart' |
9 show AnalysisContext, AnalysisEngine, AnalysisOptionsImpl; | 9 show AnalysisContext, AnalysisEngine, AnalysisOptionsImpl; |
10 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; | 10 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 context.typeProvider = sdkResolver.dartSdk.context.typeProvider; | 135 context.typeProvider = sdkResolver.dartSdk.context.typeProvider; |
136 context.resultProvider = | 136 context.resultProvider = |
137 new InputPackagesResultProvider(context, summaryData); | 137 new InputPackagesResultProvider(context, summaryData); |
138 } | 138 } |
139 return context; | 139 return context; |
140 } | 140 } |
141 | 141 |
142 /// Creates an analysis context that contains our restricted typing rules. | 142 /// Creates an analysis context that contains our restricted typing rules. |
143 AnalysisContextImpl createAnalysisContext() { | 143 AnalysisContextImpl createAnalysisContext() { |
144 var res = AnalysisEngine.instance.createAnalysisContext(); | 144 var res = AnalysisEngine.instance.createAnalysisContext(); |
145 res.analysisOptions = new AnalysisOptionsImpl()..strongMode = true; | 145 res.analysisOptions = new AnalysisOptionsImpl() |
146 ..strongMode = true | |
147 ..trackCacheDependencies = false; | |
146 return res; | 148 return res; |
147 } | 149 } |
148 | 150 |
149 /// Creates a SourceFactory configured by the [options]. | 151 /// Creates a SourceFactory configured by the [options]. |
150 /// | 152 /// |
151 /// Use [options.useMockSdk] to specify the SDK mode, or use [sdkResolver] | 153 /// Use [options.useMockSdk] to specify the SDK mode, or use [sdkResolver] |
152 /// to entirely override the DartUriResolver. | 154 /// to entirely override the DartUriResolver. |
153 /// | 155 /// |
154 /// If supplied, [fileResolvers] will override the default `file:` and | 156 /// If supplied, [fileResolvers] will override the default `file:` and |
155 /// `package:` URI resolvers. | 157 /// `package:` URI resolvers. |
(...skipping 25 matching lines...) Expand all Loading... | |
181 } | 183 } |
182 | 184 |
183 /// Creates a [DartUriResolver] that uses a mock 'dart:' library contents. | 185 /// Creates a [DartUriResolver] that uses a mock 'dart:' library contents. |
184 DartUriResolver createMockSdkResolver(Map<String, String> mockSources) => | 186 DartUriResolver createMockSdkResolver(Map<String, String> mockSources) => |
185 new MockDartSdk(mockSources, reportMissing: true).resolver; | 187 new MockDartSdk(mockSources, reportMissing: true).resolver; |
186 | 188 |
187 DirectoryBasedDartSdk _createDirectoryBasedDartSdk(String sdkPath) { | 189 DirectoryBasedDartSdk _createDirectoryBasedDartSdk(String sdkPath) { |
188 var sdk = new DirectoryBasedDartSdk( | 190 var sdk = new DirectoryBasedDartSdk( |
189 new JavaFile(sdkPath), /*useDart2jsPaths:*/ true); | 191 new JavaFile(sdkPath), /*useDart2jsPaths:*/ true); |
190 sdk.useSummary = true; | 192 sdk.useSummary = true; |
191 sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = true; | 193 sdk.analysisOptions = new AnalysisOptionsImpl() |
194 ..strongMode = true | |
195 ..trackCacheDependencies = false; | |
Jennifer Messerly
2016/06/13 18:21:11
Not sure if this matters for SDK context?
scheglov
2016/06/13 18:23:28
SDK context results are served from summary, and w
| |
192 return sdk; | 196 return sdk; |
193 } | 197 } |
194 | 198 |
195 /// Creates a [DartUriResolver] that uses the SDK at the given [sdkPath]. | 199 /// Creates a [DartUriResolver] that uses the SDK at the given [sdkPath]. |
196 DartUriResolver createSdkPathResolver(String sdkSummaryPath, String sdkPath) { | 200 DartUriResolver createSdkPathResolver(String sdkSummaryPath, String sdkPath) { |
197 var sdk = (sdkSummaryPath != null) | 201 var sdk = (sdkSummaryPath != null) |
198 ? new SummaryBasedDartSdk(sdkSummaryPath, true) | 202 ? new SummaryBasedDartSdk(sdkSummaryPath, true) |
199 : _createDirectoryBasedDartSdk(sdkPath); | 203 : _createDirectoryBasedDartSdk(sdkPath); |
200 return new DartUriResolver(sdk); | 204 return new DartUriResolver(sdk); |
201 } | 205 } |
OLD | NEW |