| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analysis.server; | 5 library analysis.server; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/analysis_logger.dart'; | 10 import 'package:analysis_server/src/analysis_logger.dart'; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 * Return `null` if there is no such context. | 275 * Return `null` if there is no such context. |
| 276 */ | 276 */ |
| 277 AnalysisContext getAnalysisContext(String path) { | 277 AnalysisContext getAnalysisContext(String path) { |
| 278 // try to find a containing context | 278 // try to find a containing context |
| 279 for (Folder folder in folderMap.keys) { | 279 for (Folder folder in folderMap.keys) { |
| 280 if (folder.contains(path)) { | 280 if (folder.contains(path)) { |
| 281 return folderMap[folder]; | 281 return folderMap[folder]; |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 // check if there is a context that analyzed this source | 284 // check if there is a context that analyzed this source |
| 285 Source source = getSource(path); | 285 return getAnalysisContextForSource(getSource(path)); |
| 286 } |
| 287 |
| 288 /** |
| 289 * Return the [AnalysisContext] that is used to analyze the given [source]. |
| 290 * Return `null` if there is no such context. |
| 291 */ |
| 292 AnalysisContext getAnalysisContextForSource(Source source) { |
| 286 for (AnalysisContext context in folderMap.values) { | 293 for (AnalysisContext context in folderMap.values) { |
| 287 SourceKind kind = context.getKindOf(source); | 294 SourceKind kind = context.getKindOf(source); |
| 288 if (kind != null) { | 295 if (kind != null) { |
| 289 return context; | 296 return context; |
| 290 } | 297 } |
| 291 } | 298 } |
| 292 return null; | 299 return null; |
| 293 } | 300 } |
| 294 | 301 |
| 295 /** | 302 /** |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 * [packageUriResolver]. | 1041 * [packageUriResolver]. |
| 1035 */ | 1042 */ |
| 1036 SourceFactory _createSourceFactory(UriResolver packageUriResolver) { | 1043 SourceFactory _createSourceFactory(UriResolver packageUriResolver) { |
| 1037 List<UriResolver> resolvers = <UriResolver>[ | 1044 List<UriResolver> resolvers = <UriResolver>[ |
| 1038 new DartUriResolver(analysisServer.defaultSdk), | 1045 new DartUriResolver(analysisServer.defaultSdk), |
| 1039 new ResourceUriResolver(resourceProvider), | 1046 new ResourceUriResolver(resourceProvider), |
| 1040 packageUriResolver]; | 1047 packageUriResolver]; |
| 1041 return new SourceFactory(resolvers); | 1048 return new SourceFactory(resolvers); |
| 1042 } | 1049 } |
| 1043 } | 1050 } |
| OLD | NEW |