| 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/context_root.dart'; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 ContextBuilder(this.resourceProvider, this.sdkManager, this.contentCache, | 135 ContextBuilder(this.resourceProvider, this.sdkManager, this.contentCache, |
| 136 {ContextBuilderOptions options}) | 136 {ContextBuilderOptions options}) |
| 137 : builderOptions = options ?? new ContextBuilderOptions(); | 137 : builderOptions = options ?? new ContextBuilderOptions(); |
| 138 | 138 |
| 139 /** | 139 /** |
| 140 * Return an analysis context that is configured correctly to analyze code in | 140 * Return an analysis context that is configured correctly to analyze code in |
| 141 * the directory with the given [path]. | 141 * the directory with the given [path]. |
| 142 * | 142 * |
| 143 * *Note:* This method is not yet fully implemented and should not be used. | 143 * *Note:* This method is not yet fully implemented and should not be used. |
| 144 */ | 144 */ |
| 145 AnalysisContext buildContext(String path) { | 145 AnalysisContext buildContext(String path, {void verbosePrint(String text)}) { |
| 146 InternalAnalysisContext context = | 146 InternalAnalysisContext context = |
| 147 AnalysisEngine.instance.createAnalysisContext(); | 147 AnalysisEngine.instance.createAnalysisContext(); |
| 148 AnalysisOptions options = getAnalysisOptions(path); | 148 AnalysisOptions options = |
| 149 getAnalysisOptions(path, verbosePrint: verbosePrint); |
| 149 context.contentCache = contentCache; | 150 context.contentCache = contentCache; |
| 150 context.sourceFactory = createSourceFactory(path, options); | 151 context.sourceFactory = createSourceFactory(path, options); |
| 151 context.analysisOptions = options; | 152 context.analysisOptions = options; |
| 152 context.name = path; | 153 context.name = path; |
| 153 //_processAnalysisOptions(context, optionMap); | 154 //_processAnalysisOptions(context, optionMap); |
| 154 declareVariables(context); | 155 declareVariables(context); |
| 155 return context; | 156 return context; |
| 156 } | 157 } |
| 157 | 158 |
| 158 /** | 159 /** |
| 159 * Return an analysis driver that is configured correctly to analyze code in | 160 * Return an analysis driver that is configured correctly to analyze code in |
| 160 * the directory with the given [path]. | 161 * the directory with the given [path]. |
| 161 */ | 162 */ |
| 162 AnalysisDriver buildDriver(ContextRoot contextRoot) { | 163 AnalysisDriver buildDriver(ContextRoot contextRoot, |
| 164 {void verbosePrint(String text)}) { |
| 163 String path = contextRoot.root; | 165 String path = contextRoot.root; |
| 164 AnalysisOptions options = getAnalysisOptions(path); | 166 AnalysisOptions options = |
| 167 getAnalysisOptions(path, verbosePrint: verbosePrint); |
| 165 //_processAnalysisOptions(context, optionMap); | 168 //_processAnalysisOptions(context, optionMap); |
| 166 final sf = createSourceFactory(path, options); | 169 final sf = createSourceFactory(path, options); |
| 167 AnalysisDriver driver = new AnalysisDriver( | 170 AnalysisDriver driver = new AnalysisDriver( |
| 168 analysisDriverScheduler, | 171 analysisDriverScheduler, |
| 169 performanceLog, | 172 performanceLog, |
| 170 resourceProvider, | 173 resourceProvider, |
| 171 byteStore, | 174 byteStore, |
| 172 fileContentOverlay, | 175 fileContentOverlay, |
| 173 contextRoot, | 176 contextRoot, |
| 174 sf, | 177 sf, |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 throw new ArgumentError('not absolute: $path'); | 821 throw new ArgumentError('not absolute: $path'); |
| 819 } | 822 } |
| 820 path = context.normalize(path); | 823 path = context.normalize(path); |
| 821 Resource resource = provider.getResource(path); | 824 Resource resource = provider.getResource(path); |
| 822 if (resource is File) { | 825 if (resource is File) { |
| 823 path = resource.parent.path; | 826 path = resource.parent.path; |
| 824 } | 827 } |
| 825 return new _BasicWorkspace._(provider, path, builder); | 828 return new _BasicWorkspace._(provider, path, builder); |
| 826 } | 829 } |
| 827 } | 830 } |
| OLD | NEW |