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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
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'; |
11 import 'package:analyzer/file_system/file_system.dart'; | 11 import 'package:analyzer/file_system/file_system.dart'; |
12 import 'package:analyzer/instrumentation/instrumentation.dart'; | 12 import 'package:analyzer/instrumentation/instrumentation.dart'; |
13 import 'package:analyzer/plugin/resolver_provider.dart'; | 13 import 'package:analyzer/plugin/resolver_provider.dart'; |
14 import 'package:analyzer/source/analysis_options_provider.dart'; | 14 import 'package:analyzer/source/analysis_options_provider.dart'; |
15 import 'package:analyzer/source/package_map_provider.dart'; | 15 import 'package:analyzer/source/package_map_provider.dart'; |
16 import 'package:analyzer/source/package_map_resolver.dart'; | 16 import 'package:analyzer/source/package_map_resolver.dart'; |
17 import 'package:analyzer/source/path_filter.dart'; | 17 import 'package:analyzer/source/path_filter.dart'; |
18 import 'package:analyzer/source/pub_package_map_provider.dart'; | 18 import 'package:analyzer/source/pub_package_map_provider.dart'; |
19 import 'package:analyzer/source/sdk_ext.dart'; | 19 import 'package:analyzer/source/sdk_ext.dart'; |
20 import 'package:analyzer/src/context/builder.dart'; | 20 import 'package:analyzer/src/context/builder.dart'; |
21 import 'package:analyzer/src/context/context.dart' as context; | |
22 import 'package:analyzer/src/dart/analysis/driver.dart'; | 21 import 'package:analyzer/src/dart/analysis/driver.dart'; |
23 import 'package:analyzer/src/dart/sdk/sdk.dart'; | 22 import 'package:analyzer/src/dart/sdk/sdk.dart'; |
24 import 'package:analyzer/src/generated/engine.dart'; | 23 import 'package:analyzer/src/generated/engine.dart'; |
25 import 'package:analyzer/src/generated/java_io.dart'; | 24 import 'package:analyzer/src/generated/java_io.dart'; |
26 import 'package:analyzer/src/generated/sdk.dart'; | 25 import 'package:analyzer/src/generated/sdk.dart'; |
27 import 'package:analyzer/src/generated/source.dart'; | 26 import 'package:analyzer/src/generated/source.dart'; |
28 import 'package:analyzer/src/generated/source_io.dart'; | 27 import 'package:analyzer/src/generated/source_io.dart'; |
29 import 'package:analyzer/src/task/options.dart'; | 28 import 'package:analyzer/src/task/options.dart'; |
30 import 'package:analyzer/src/util/absolute_path.dart'; | 29 import 'package:analyzer/src/util/absolute_path.dart'; |
31 import 'package:analyzer/src/util/glob.dart'; | 30 import 'package:analyzer/src/util/glob.dart'; |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 /** | 521 /** |
523 * The default options used to create new analysis contexts. | 522 * The default options used to create new analysis contexts. |
524 */ | 523 */ |
525 final AnalysisOptionsImpl defaultContextOptions; | 524 final AnalysisOptionsImpl defaultContextOptions; |
526 | 525 |
527 /** | 526 /** |
528 * The instrumentation service used to report instrumentation data. | 527 * The instrumentation service used to report instrumentation data. |
529 */ | 528 */ |
530 final InstrumentationService _instrumentationService; | 529 final InstrumentationService _instrumentationService; |
531 | 530 |
532 final bool enableNewAnalysisDriver; | |
533 | |
534 @override | 531 @override |
535 ContextManagerCallbacks callbacks; | 532 ContextManagerCallbacks callbacks; |
536 | 533 |
537 /** | 534 /** |
538 * Virtual [ContextInfo] which acts as the ancestor of all other | 535 * Virtual [ContextInfo] which acts as the ancestor of all other |
539 * [ContextInfo]s. | 536 * [ContextInfo]s. |
540 */ | 537 */ |
541 final ContextInfo rootInfo = new ContextInfo._root(); | 538 final ContextInfo rootInfo = new ContextInfo._root(); |
542 | 539 |
543 @override | 540 @override |
544 final Map<Folder, AnalysisDriver> driverMap = | 541 final Map<Folder, AnalysisDriver> driverMap = |
545 new HashMap<Folder, AnalysisDriver>(); | 542 new HashMap<Folder, AnalysisDriver>(); |
546 | 543 |
547 /** | 544 /** |
548 * A table mapping [Folder]s to the [AnalysisContext]s associated with them. | |
549 */ | |
550 final Map<Folder, AnalysisContext> _folderMap = | |
551 new HashMap<Folder, AnalysisContext>(); | |
552 | |
553 /** | |
554 * Stream subscription we are using to watch each analysis root directory for | 545 * Stream subscription we are using to watch each analysis root directory for |
555 * changes. | 546 * changes. |
556 */ | 547 */ |
557 final Map<Folder, StreamSubscription<WatchEvent>> changeSubscriptions = | 548 final Map<Folder, StreamSubscription<WatchEvent>> changeSubscriptions = |
558 <Folder, StreamSubscription<WatchEvent>>{}; | 549 <Folder, StreamSubscription<WatchEvent>>{}; |
559 | 550 |
560 ContextManagerImpl( | 551 ContextManagerImpl( |
561 this.resourceProvider, | 552 this.resourceProvider, |
562 this.sdkManager, | 553 this.sdkManager, |
563 this.packageResolverProvider, | 554 this.packageResolverProvider, |
564 this._packageMapProvider, | 555 this._packageMapProvider, |
565 this.analyzedFilesGlobs, | 556 this.analyzedFilesGlobs, |
566 this._instrumentationService, | 557 this._instrumentationService, |
567 this.defaultContextOptions, | 558 this.defaultContextOptions) { |
568 this.enableNewAnalysisDriver) { | |
569 absolutePathContext = resourceProvider.absolutePathContext; | 559 absolutePathContext = resourceProvider.absolutePathContext; |
570 pathContext = resourceProvider.pathContext; | 560 pathContext = resourceProvider.pathContext; |
571 } | 561 } |
572 | 562 |
573 @override | 563 @override |
574 Iterable<AnalysisContext> get analysisContexts => folderMap.values; | 564 Iterable<AnalysisContext> get analysisContexts => folderMap.values; |
575 | 565 |
576 Map<Folder, AnalysisContext> get folderMap { | 566 Map<Folder, AnalysisContext> get folderMap { |
577 if (enableNewAnalysisDriver) { | 567 throw new StateError('Should not be used with the new analysis driver'); |
578 throw new StateError('Should not be used with the new analysis driver'); | |
579 } else { | |
580 return _folderMap; | |
581 } | |
582 } | 568 } |
583 | 569 |
584 @override | 570 @override |
585 List<AnalysisContext> contextsInAnalysisRoot(Folder analysisRoot) { | 571 List<AnalysisContext> contextsInAnalysisRoot(Folder analysisRoot) { |
586 List<AnalysisContext> contexts = <AnalysisContext>[]; | 572 List<AnalysisContext> contexts = <AnalysisContext>[]; |
587 ContextInfo innermostContainingInfo = | 573 ContextInfo innermostContainingInfo = |
588 _getInnermostContextInfoFor(analysisRoot.path); | 574 _getInnermostContextInfoFor(analysisRoot.path); |
589 void addContextAndDescendants(ContextInfo info) { | 575 void addContextAndDescendants(ContextInfo info) { |
590 contexts.add(info.context); | 576 contexts.add(info.context); |
591 info.children.forEach(addContextAndDescendants); | 577 info.children.forEach(addContextAndDescendants); |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 continue; | 987 continue; |
1002 } | 988 } |
1003 _addSourceFiles(changeSet, child, info); | 989 _addSourceFiles(changeSet, child, info); |
1004 } | 990 } |
1005 } | 991 } |
1006 } | 992 } |
1007 | 993 |
1008 void _checkForAnalysisOptionsUpdate( | 994 void _checkForAnalysisOptionsUpdate( |
1009 String path, ContextInfo info, ChangeType changeType) { | 995 String path, ContextInfo info, ChangeType changeType) { |
1010 if (AnalysisEngine.isAnalysisOptionsFileName(path, pathContext)) { | 996 if (AnalysisEngine.isAnalysisOptionsFileName(path, pathContext)) { |
1011 if (enableNewAnalysisDriver) { | 997 AnalysisDriver driver = info.analysisDriver; |
1012 AnalysisDriver driver = info.analysisDriver; | 998 String contextRoot = info.folder.path; |
1013 String contextRoot = info.folder.path; | 999 ContextBuilder builder = |
1014 ContextBuilder builder = | 1000 callbacks.createContextBuilder(info.folder, defaultContextOptions); |
1015 callbacks.createContextBuilder(info.folder, defaultContextOptions); | 1001 AnalysisOptions options = builder.getAnalysisOptions(contextRoot, |
1016 AnalysisOptions options = builder.getAnalysisOptions(contextRoot, | 1002 contextRoot: driver.contextRoot); |
1017 contextRoot: driver.contextRoot); | 1003 SourceFactory factory = builder.createSourceFactory(contextRoot, options); |
1018 SourceFactory factory = | 1004 driver.configure(analysisOptions: options, sourceFactory: factory); |
1019 builder.createSourceFactory(contextRoot, options); | 1005 // TODO(brianwilkerson) Set exclusion patterns. |
1020 driver.configure(analysisOptions: options, sourceFactory: factory); | |
1021 // TODO(brianwilkerson) Set exclusion patterns. | |
1022 } else { | |
1023 var analysisContext = info.context; | |
1024 if (analysisContext is context.AnalysisContextImpl) { | |
1025 Map<String, Object> options = | |
1026 readOptions(info.folder, info.disposition.packages); | |
1027 processOptionsForContext(info, options, | |
1028 optionsRemoved: changeType == ChangeType.REMOVE); | |
1029 analysisContext.sourceFactory = _createSourceFactory( | |
1030 analysisContext, analysisContext.analysisOptions, info.folder); | |
1031 callbacks.applyChangesToContext(info.folder, new ChangeSet()); | |
1032 } | |
1033 } | |
1034 } | 1006 } |
1035 } | 1007 } |
1036 | 1008 |
1037 void _checkForPackagespecUpdate( | 1009 void _checkForPackagespecUpdate( |
1038 String path, ContextInfo info, Folder folder) { | 1010 String path, ContextInfo info, Folder folder) { |
1039 // Check to see if this is the .packages file for this context and if so, | 1011 // Check to see if this is the .packages file for this context and if so, |
1040 // update the context's source factory. | 1012 // update the context's source factory. |
1041 if (absolutePathContext.basename(path) == PACKAGE_SPEC_NAME) { | 1013 if (absolutePathContext.basename(path) == PACKAGE_SPEC_NAME) { |
1042 String contextRoot = info.folder.path; | 1014 String contextRoot = info.folder.path; |
1043 ContextBuilder builder = | 1015 ContextBuilder builder = |
1044 callbacks.createContextBuilder(info.folder, defaultContextOptions); | 1016 callbacks.createContextBuilder(info.folder, defaultContextOptions); |
1045 AnalysisOptions options = builder.getAnalysisOptions(contextRoot, | 1017 AnalysisOptions options = builder.getAnalysisOptions(contextRoot, |
1046 contextRoot: info.analysisDriver?.contextRoot); | 1018 contextRoot: info.analysisDriver?.contextRoot); |
1047 SourceFactory factory = builder.createSourceFactory(contextRoot, options); | 1019 SourceFactory factory = builder.createSourceFactory(contextRoot, options); |
1048 if (enableNewAnalysisDriver) { | 1020 AnalysisDriver driver = info.analysisDriver; |
1049 AnalysisDriver driver = info.analysisDriver; | 1021 driver.configure(analysisOptions: options, sourceFactory: factory); |
1050 driver.configure(analysisOptions: options, sourceFactory: factory); | |
1051 } else { | |
1052 info.context.analysisOptions = options; | |
1053 info.context.sourceFactory = factory; | |
1054 } | |
1055 } | 1022 } |
1056 } | 1023 } |
1057 | 1024 |
1058 /** | 1025 /** |
1059 * Compute the set of files that are being flushed, this is defined as | 1026 * Compute the set of files that are being flushed, this is defined as |
1060 * the set of sources in the removed context (context.sources), that are | 1027 * the set of sources in the removed context (context.sources), that are |
1061 * orphaned by this context being removed (no other context includes this | 1028 * orphaned by this context being removed (no other context includes this |
1062 * file.) | 1029 * file.) |
1063 */ | 1030 */ |
1064 List<String> _computeFlushedFiles(ContextInfo info) { | 1031 List<String> _computeFlushedFiles(ContextInfo info) { |
1065 if (enableNewAnalysisDriver) { | 1032 Set<String> flushedFiles = info.analysisDriver.addedFiles.toSet(); |
1066 Set<String> flushedFiles = info.analysisDriver.addedFiles.toSet(); | 1033 for (ContextInfo contextInfo in rootInfo.descendants) { |
1067 for (ContextInfo contextInfo in rootInfo.descendants) { | 1034 AnalysisDriver other = contextInfo.analysisDriver; |
1068 AnalysisDriver other = contextInfo.analysisDriver; | 1035 if (other != info.analysisDriver) { |
1069 if (other != info.analysisDriver) { | 1036 flushedFiles.removeAll(other.addedFiles); |
1070 flushedFiles.removeAll(other.addedFiles); | |
1071 } | |
1072 } | 1037 } |
1073 return flushedFiles.toList(growable: false); | |
1074 } else { | |
1075 AnalysisContext context = info.context; | |
1076 HashSet<String> flushedFiles = new HashSet<String>(); | |
1077 for (Source source in context.sources) { | |
1078 flushedFiles.add(source.fullName); | |
1079 } | |
1080 for (ContextInfo contextInfo in rootInfo.descendants) { | |
1081 AnalysisContext contextN = contextInfo.context; | |
1082 if (context != contextN) { | |
1083 for (Source source in contextN.sources) { | |
1084 flushedFiles.remove(source.fullName); | |
1085 } | |
1086 } | |
1087 } | |
1088 return flushedFiles.toList(growable: false); | |
1089 } | 1038 } |
| 1039 return flushedFiles.toList(growable: false); |
1090 } | 1040 } |
1091 | 1041 |
1092 /** | 1042 /** |
1093 * Compute the appropriate [FolderDisposition] for [folder]. Use | 1043 * Compute the appropriate [FolderDisposition] for [folder]. Use |
1094 * [addDependency] to indicate which files needed to be consulted in order to | 1044 * [addDependency] to indicate which files needed to be consulted in order to |
1095 * figure out the [FolderDisposition]; these dependencies will be watched in | 1045 * figure out the [FolderDisposition]; these dependencies will be watched in |
1096 * order to determine when it is necessary to call this function again. | 1046 * order to determine when it is necessary to call this function again. |
1097 * | 1047 * |
1098 * TODO(paulberry): use [addDependency] for tracking all folder disposition | 1048 * TODO(paulberry): use [addDependency] for tracking all folder disposition |
1099 * dependencies (currently we only use it to track "pub list" dependencies). | 1049 * dependencies (currently we only use it to track "pub list" dependencies). |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 ContextInfo info = new ContextInfo(this, parent, folder, packagesFile, | 1130 ContextInfo info = new ContextInfo(this, parent, folder, packagesFile, |
1181 normalizedPackageRoots[folder.path], disposition); | 1131 normalizedPackageRoots[folder.path], disposition); |
1182 | 1132 |
1183 Map<String, Object> optionMap = | 1133 Map<String, Object> optionMap = |
1184 readOptions(info.folder, disposition.packages); | 1134 readOptions(info.folder, disposition.packages); |
1185 AnalysisOptions options = | 1135 AnalysisOptions options = |
1186 new AnalysisOptionsImpl.from(defaultContextOptions); | 1136 new AnalysisOptionsImpl.from(defaultContextOptions); |
1187 applyToAnalysisOptions(options, optionMap); | 1137 applyToAnalysisOptions(options, optionMap); |
1188 | 1138 |
1189 info.setDependencies(dependencies); | 1139 info.setDependencies(dependencies); |
1190 if (enableNewAnalysisDriver) { | 1140 String includedPath = folder.path; |
1191 String includedPath = folder.path; | 1141 List<String> containedExcludedPaths = excludedPaths |
1192 List<String> containedExcludedPaths = excludedPaths | 1142 .where((String excludedPath) => |
1193 .where((String excludedPath) => | 1143 pathContext.isWithin(includedPath, excludedPath)) |
1194 pathContext.isWithin(includedPath, excludedPath)) | 1144 .toList(); |
1195 .toList(); | 1145 processOptionsForDriver(info, options, optionMap); |
1196 processOptionsForDriver(info, options, optionMap); | 1146 info.analysisDriver = callbacks.addAnalysisDriver( |
1197 info.analysisDriver = callbacks.addAnalysisDriver(folder, | 1147 folder, new ContextRoot(folder.path, containedExcludedPaths), options); |
1198 new ContextRoot(folder.path, containedExcludedPaths), options); | |
1199 } else { | |
1200 info.context = callbacks.addContext(folder, options); | |
1201 _folderMap[folder] = info.context; | |
1202 info.context.name = folder.path; | |
1203 processOptionsForContext(info, optionMap); | |
1204 } | |
1205 | |
1206 return info; | 1148 return info; |
1207 } | 1149 } |
1208 | 1150 |
1209 /** | 1151 /** |
1210 * Potentially create a new context associated with the given [folder]. | 1152 * Potentially create a new context associated with the given [folder]. |
1211 * | 1153 * |
1212 * If there are subfolders with 'pubspec.yaml' files, separate contexts are | 1154 * If there are subfolders with 'pubspec.yaml' files, separate contexts are |
1213 * created for them and excluded from the context associated with the | 1155 * created for them and excluded from the context associated with the |
1214 * [folder]. | 1156 * [folder]. |
1215 * | 1157 * |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1463 } | 1405 } |
1464 } | 1406 } |
1465 } | 1407 } |
1466 | 1408 |
1467 // If the file went away and was replaced by a folder before we | 1409 // If the file went away and was replaced by a folder before we |
1468 // had a chance to process the event, resource might be a Folder. In | 1410 // had a chance to process the event, resource might be a Folder. In |
1469 // that case don't add it. | 1411 // that case don't add it. |
1470 if (resource is File) { | 1412 if (resource is File) { |
1471 File file = resource; | 1413 File file = resource; |
1472 if (_shouldFileBeAnalyzed(file)) { | 1414 if (_shouldFileBeAnalyzed(file)) { |
1473 if (enableNewAnalysisDriver) { | 1415 info.analysisDriver.addFile(path); |
1474 info.analysisDriver.addFile(path); | |
1475 } else { | |
1476 ChangeSet changeSet = new ChangeSet(); | |
1477 Source source = createSourceInContext(info.context, file); | |
1478 changeSet.addedSource(source); | |
1479 callbacks.applyChangesToContext(info.folder, changeSet); | |
1480 info.sources[path] = source; | |
1481 } | |
1482 } | 1416 } |
1483 } | 1417 } |
1484 break; | 1418 break; |
1485 case ChangeType.REMOVE: | 1419 case ChangeType.REMOVE: |
1486 | 1420 |
1487 // If package spec info is removed, check to see if we can merge context
s. | 1421 // If package spec info is removed, check to see if we can merge context
s. |
1488 // Note that it's important to verify that there is NEITHER a .packages
nor a | 1422 // Note that it's important to verify that there is NEITHER a .packages
nor a |
1489 // lingering pubspec.yaml before merging. | 1423 // lingering pubspec.yaml before merging. |
1490 if (!info.isTopLevel) { | 1424 if (!info.isTopLevel) { |
1491 String directoryPath = absolutePathContext.dirname(path); | 1425 String directoryPath = absolutePathContext.dirname(path); |
(...skipping 16 matching lines...) Expand all Loading... |
1508 .getFile( | 1442 .getFile( |
1509 absolutePathContext.append(directoryPath, PUBSPEC_NAME)) | 1443 absolutePathContext.append(directoryPath, PUBSPEC_NAME)) |
1510 .exists) { | 1444 .exists) { |
1511 _mergeContext(info); | 1445 _mergeContext(info); |
1512 return; | 1446 return; |
1513 } | 1447 } |
1514 } | 1448 } |
1515 } | 1449 } |
1516 } | 1450 } |
1517 | 1451 |
1518 if (enableNewAnalysisDriver) { | 1452 callbacks.applyFileRemoved(info.analysisDriver, path); |
1519 callbacks.applyFileRemoved(info.analysisDriver, path); | |
1520 } else { | |
1521 List<Source> sources = info.context.getSourcesWithFullName(path); | |
1522 if (!sources.isEmpty) { | |
1523 ChangeSet changeSet = new ChangeSet(); | |
1524 sources.forEach((Source source) { | |
1525 changeSet.removedSource(source); | |
1526 }); | |
1527 callbacks.applyChangesToContext(info.folder, changeSet); | |
1528 info.sources.remove(path); | |
1529 } | |
1530 } | |
1531 break; | 1453 break; |
1532 case ChangeType.MODIFY: | 1454 case ChangeType.MODIFY: |
1533 if (enableNewAnalysisDriver) { | 1455 for (AnalysisDriver driver in driverMap.values) { |
1534 for (AnalysisDriver driver in driverMap.values) { | 1456 driver.changeFile(path); |
1535 driver.changeFile(path); | |
1536 } | |
1537 } else { | |
1538 List<Source> sources = info.context.getSourcesWithFullName(path); | |
1539 if (!sources.isEmpty) { | |
1540 ChangeSet changeSet = new ChangeSet(); | |
1541 sources.forEach((Source source) { | |
1542 changeSet.changedSource(source); | |
1543 }); | |
1544 callbacks.applyChangesToContext(info.folder, changeSet); | |
1545 } | |
1546 } | 1457 } |
1547 break; | 1458 break; |
1548 } | 1459 } |
1549 _checkForPackagespecUpdate(path, info, info.folder); | 1460 _checkForPackagespecUpdate(path, info, info.folder); |
1550 _checkForAnalysisOptionsUpdate(path, info, type); | 1461 _checkForAnalysisOptionsUpdate(path, info, type); |
1551 } | 1462 } |
1552 | 1463 |
1553 /** | 1464 /** |
1554 * Determine whether the given [path], when interpreted relative to the | 1465 * Determine whether the given [path], when interpreted relative to the |
1555 * context root [root], contains a folder whose name starts with '.'. | 1466 * context root [root], contains a folder whose name starts with '.'. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 } else { | 1606 } else { |
1696 return null; | 1607 return null; |
1697 } | 1608 } |
1698 } | 1609 } |
1699 return stringMap; | 1610 return stringMap; |
1700 } | 1611 } |
1701 return null; | 1612 return null; |
1702 } | 1613 } |
1703 | 1614 |
1704 void _updateContextPackageUriResolver(Folder contextFolder) { | 1615 void _updateContextPackageUriResolver(Folder contextFolder) { |
1705 if (enableNewAnalysisDriver) { | 1616 ContextInfo info = getContextInfoFor(contextFolder); |
1706 ContextInfo info = getContextInfoFor(contextFolder); | 1617 AnalysisDriver driver = info.analysisDriver; |
1707 AnalysisDriver driver = info.analysisDriver; | 1618 SourceFactory sourceFactory = |
1708 SourceFactory sourceFactory = | 1619 _createSourceFactory(null, driver.analysisOptions, contextFolder); |
1709 _createSourceFactory(null, driver.analysisOptions, contextFolder); | 1620 driver.configure(sourceFactory: sourceFactory); |
1710 driver.configure(sourceFactory: sourceFactory); | |
1711 } else { | |
1712 AnalysisContext context = folderMap[contextFolder]; | |
1713 context.sourceFactory = | |
1714 _createSourceFactory(context, context.analysisOptions, contextFolder); | |
1715 callbacks.updateContextPackageUriResolver(context); | |
1716 } | |
1717 } | 1621 } |
1718 | 1622 |
1719 /** | 1623 /** |
1720 * Create and return a source representing the given [file] within the given | 1624 * Create and return a source representing the given [file] within the given |
1721 * [context]. | 1625 * [context]. |
1722 */ | 1626 */ |
1723 static Source createSourceInContext(AnalysisContext context, File file) { | 1627 static Source createSourceInContext(AnalysisContext context, File file) { |
1724 // TODO(brianwilkerson) Optimize this, by allowing support for source | 1628 // TODO(brianwilkerson) Optimize this, by allowing support for source |
1725 // factories to restore URI's from a file path rather than a source. | 1629 // factories to restore URI's from a file path rather than a source. |
1726 Source source = file.createSource(); | 1630 Source source = file.createSource(); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1971 } | 1875 } |
1972 return _embedderLocator; | 1876 return _embedderLocator; |
1973 } | 1877 } |
1974 | 1878 |
1975 @override | 1879 @override |
1976 SdkExtensionFinder getSdkExtensionFinder(ResourceProvider resourceProvider) { | 1880 SdkExtensionFinder getSdkExtensionFinder(ResourceProvider resourceProvider) { |
1977 return _sdkExtensionFinder ??= | 1881 return _sdkExtensionFinder ??= |
1978 new SdkExtensionFinder(buildPackageMap(resourceProvider)); | 1882 new SdkExtensionFinder(buildPackageMap(resourceProvider)); |
1979 } | 1883 } |
1980 } | 1884 } |
OLD | NEW |