Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Side by Side Diff: pkg/analyzer/lib/src/context/builder.dart

Issue 2742343006: Formalizing the hacks letting the angular analyzer plugin run for now. (Closed)
Patch Set: Rename variable not method Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/lib/starter.dart ('k') | pkg/analyzer/lib/src/dart/analysis/driver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/declared_variables.dart'; 10 import 'package:analyzer/context/declared_variables.dart';
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 * 4. Look for an analysis options file (`analyis_options.yaml` or 53 * 4. Look for an analysis options file (`analyis_options.yaml` or
54 * `.analysis_options`) and process the options in the file. 54 * `.analysis_options`) and process the options in the file.
55 * 55 *
56 * 5. Create a new context. Initialize its source factory based on steps 1, 2 56 * 5. Create a new context. Initialize its source factory based on steps 1, 2
57 * and 3. Initialize its analysis options from step 4. 57 * and 3. Initialize its analysis options from step 4.
58 * 58 *
59 * [1]: https://github.com/dart-lang/dart_enhancement_proposals/blob/master/Acce pted/0005%20-%20Package%20Specification/DEP-pkgspec.md. 59 * [1]: https://github.com/dart-lang/dart_enhancement_proposals/blob/master/Acce pted/0005%20-%20Package%20Specification/DEP-pkgspec.md.
60 */ 60 */
61 class ContextBuilder { 61 class ContextBuilder {
62 /** 62 /**
63 * A callback for when analysis drivers are created, which takes all the same
64 * arguments as the dart analysis driver constructor so that plugins may
65 * create their own drivers with the same tools, in theory. Here as a stopgap
66 * until the official plugin API is complete
67 */
68 static Function onCreateAnalysisDriver = null;
69
70 /**
63 * The [ResourceProvider] by which paths are converted into [Resource]s. 71 * The [ResourceProvider] by which paths are converted into [Resource]s.
64 */ 72 */
65 final ResourceProvider resourceProvider; 73 final ResourceProvider resourceProvider;
66 74
67 /** 75 /**
68 * The manager used to manage the DartSdk's that have been created so that 76 * The manager used to manage the DartSdk's that have been created so that
69 * they can be shared across contexts. 77 * they can be shared across contexts.
70 */ 78 */
71 final DartSdkManager sdkManager; 79 final DartSdkManager sdkManager;
72 80
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 return context; 150 return context;
143 } 151 }
144 152
145 /** 153 /**
146 * Return an analysis driver that is configured correctly to analyze code in 154 * Return an analysis driver that is configured correctly to analyze code in
147 * the directory with the given [path]. 155 * the directory with the given [path].
148 */ 156 */
149 AnalysisDriver buildDriver(String path) { 157 AnalysisDriver buildDriver(String path) {
150 AnalysisOptions options = getAnalysisOptions(path); 158 AnalysisOptions options = getAnalysisOptions(path);
151 //_processAnalysisOptions(context, optionMap); 159 //_processAnalysisOptions(context, optionMap);
160 final sf = createSourceFactory(path, options);
152 AnalysisDriver driver = new AnalysisDriver( 161 AnalysisDriver driver = new AnalysisDriver(
153 analysisDriverScheduler, 162 analysisDriverScheduler,
154 performanceLog, 163 performanceLog,
155 resourceProvider, 164 resourceProvider,
156 byteStore, 165 byteStore,
157 fileContentOverlay, 166 fileContentOverlay,
158 path, 167 path,
159 createSourceFactory(path, options), 168 sf,
160 options); 169 options);
170 // temporary plugin support:
171 if (onCreateAnalysisDriver != null) {
172 onCreateAnalysisDriver(driver, analysisDriverScheduler, performanceLog,
173 resourceProvider, byteStore, fileContentOverlay, path, sf, options);
174 }
161 declareVariablesInDriver(driver); 175 declareVariablesInDriver(driver);
162 return driver; 176 return driver;
163 } 177 }
164 178
165 Map<String, List<Folder>> convertPackagesToMap(Packages packages) { 179 Map<String, List<Folder>> convertPackagesToMap(Packages packages) {
166 Map<String, List<Folder>> folderMap = new HashMap<String, List<Folder>>(); 180 Map<String, List<Folder>> folderMap = new HashMap<String, List<Folder>>();
167 if (packages != null && packages != Packages.noPackages) { 181 if (packages != null && packages != Packages.noPackages) {
168 packages.asMap().forEach((String packageName, Uri uri) { 182 packages.asMap().forEach((String packageName, Uri uri) {
169 String path = resourceProvider.pathContext.fromUri(uri); 183 String path = resourceProvider.pathContext.fromUri(uri);
170 folderMap[packageName] = [resourceProvider.getFolder(path)]; 184 folderMap[packageName] = [resourceProvider.getFolder(path)];
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 803
790 // Ensure that the path is absolute and normalized. 804 // Ensure that the path is absolute and normalized.
791 if (!context.isAbsolute(path)) { 805 if (!context.isAbsolute(path)) {
792 throw new ArgumentError('not absolute: $path'); 806 throw new ArgumentError('not absolute: $path');
793 } 807 }
794 path = context.normalize(path); 808 path = context.normalize(path);
795 809
796 return new _BasicWorkspace._(provider, path, builder); 810 return new _BasicWorkspace._(provider, path, builder);
797 } 811 }
798 } 812 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/starter.dart ('k') | pkg/analyzer/lib/src/dart/analysis/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698