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 library analyzer.src.context.context_builder; | 5 library analyzer.src.context.context_builder; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:core'; | 8 import 'dart:core'; |
9 | 9 |
| 10 import 'package:analyzer/context/context_root.dart'; |
10 import 'package:analyzer/context/declared_variables.dart'; | 11 import 'package:analyzer/context/declared_variables.dart'; |
11 import 'package:analyzer/file_system/file_system.dart'; | 12 import 'package:analyzer/file_system/file_system.dart'; |
12 import 'package:analyzer/plugin/resolver_provider.dart'; | 13 import 'package:analyzer/plugin/resolver_provider.dart'; |
13 import 'package:analyzer/source/analysis_options_provider.dart'; | 14 import 'package:analyzer/source/analysis_options_provider.dart'; |
14 import 'package:analyzer/source/package_map_resolver.dart'; | 15 import 'package:analyzer/source/package_map_resolver.dart'; |
15 import 'package:analyzer/src/command_line/arguments.dart' | 16 import 'package:analyzer/src/command_line/arguments.dart' |
16 show | 17 show |
17 applyAnalysisOptionFlags, | 18 applyAnalysisOptionFlags, |
18 bazelAnalysisOptionsPath, | 19 bazelAnalysisOptionsPath, |
19 flutterAnalysisOptionsPath; | 20 flutterAnalysisOptionsPath; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 context.name = path; | 151 context.name = path; |
151 //_processAnalysisOptions(context, optionMap); | 152 //_processAnalysisOptions(context, optionMap); |
152 declareVariables(context); | 153 declareVariables(context); |
153 return context; | 154 return context; |
154 } | 155 } |
155 | 156 |
156 /** | 157 /** |
157 * Return an analysis driver that is configured correctly to analyze code in | 158 * Return an analysis driver that is configured correctly to analyze code in |
158 * the directory with the given [path]. | 159 * the directory with the given [path]. |
159 */ | 160 */ |
160 AnalysisDriver buildDriver(String path) { | 161 AnalysisDriver buildDriver(ContextRoot contextRoot) { |
| 162 String path = contextRoot.root; |
161 AnalysisOptions options = getAnalysisOptions(path); | 163 AnalysisOptions options = getAnalysisOptions(path); |
162 //_processAnalysisOptions(context, optionMap); | 164 //_processAnalysisOptions(context, optionMap); |
163 final sf = createSourceFactory(path, options); | 165 final sf = createSourceFactory(path, options); |
164 AnalysisDriver driver = new AnalysisDriver( | 166 AnalysisDriver driver = new AnalysisDriver( |
165 analysisDriverScheduler, | 167 analysisDriverScheduler, |
166 performanceLog, | 168 performanceLog, |
167 resourceProvider, | 169 resourceProvider, |
168 byteStore, | 170 byteStore, |
169 fileContentOverlay, | 171 fileContentOverlay, |
170 path, | 172 contextRoot, |
171 sf, | 173 sf, |
172 options); | 174 options); |
173 // temporary plugin support: | 175 // temporary plugin support: |
174 if (onCreateAnalysisDriver != null) { | 176 if (onCreateAnalysisDriver != null) { |
175 onCreateAnalysisDriver(driver, analysisDriverScheduler, performanceLog, | 177 onCreateAnalysisDriver(driver, analysisDriverScheduler, performanceLog, |
176 resourceProvider, byteStore, fileContentOverlay, path, sf, options); | 178 resourceProvider, byteStore, fileContentOverlay, path, sf, options); |
177 } | 179 } |
178 declareVariablesInDriver(driver); | 180 declareVariablesInDriver(driver); |
179 return driver; | 181 return driver; |
180 } | 182 } |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 | 814 |
813 // Ensure that the path is absolute and normalized. | 815 // Ensure that the path is absolute and normalized. |
814 if (!context.isAbsolute(path)) { | 816 if (!context.isAbsolute(path)) { |
815 throw new ArgumentError('not absolute: $path'); | 817 throw new ArgumentError('not absolute: $path'); |
816 } | 818 } |
817 path = context.normalize(path); | 819 path = context.normalize(path); |
818 | 820 |
819 return new _BasicWorkspace._(provider, path, builder); | 821 return new _BasicWorkspace._(provider, path, builder); |
820 } | 822 } |
821 } | 823 } |
OLD | NEW |