| 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 test.context.directory.manager; | 5 library test.context.directory.manager; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/context_manager.dart'; | 9 import 'package:analysis_server/src/context_manager.dart'; |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1628 | 1628 |
| 1629 @override | 1629 @override |
| 1630 AnalysisContext addContext(Folder folder, FolderDisposition disposition) { | 1630 AnalysisContext addContext(Folder folder, FolderDisposition disposition) { |
| 1631 String path = folder.path; | 1631 String path = folder.path; |
| 1632 expect(currentContextPaths, isNot(contains(path))); | 1632 expect(currentContextPaths, isNot(contains(path))); |
| 1633 currentContextTimestamps[path] = now; | 1633 currentContextTimestamps[path] = now; |
| 1634 currentContextFilePaths[path] = <String, int>{}; | 1634 currentContextFilePaths[path] = <String, int>{}; |
| 1635 currentContextSources[path] = new HashSet<Source>(); | 1635 currentContextSources[path] = new HashSet<Source>(); |
| 1636 currentContextDispositions[path] = disposition; | 1636 currentContextDispositions[path] = disposition; |
| 1637 currentContext = AnalysisEngine.instance.createAnalysisContext(); | 1637 currentContext = AnalysisEngine.instance.createAnalysisContext(); |
| 1638 List<UriResolver> resolvers = [new FileUriResolver()]; | 1638 List<UriResolver> resolvers = []; |
| 1639 resolvers.addAll(disposition.createPackageUriResolvers(resourceProvider)); | 1639 resolvers.addAll(disposition.createPackageUriResolvers(resourceProvider)); |
| 1640 resolvers.add(new FileUriResolver()); |
| 1640 currentContext.sourceFactory = | 1641 currentContext.sourceFactory = |
| 1641 new SourceFactory(resolvers, disposition.packages); | 1642 new SourceFactory(resolvers, disposition.packages); |
| 1642 return currentContext; | 1643 return currentContext; |
| 1643 } | 1644 } |
| 1644 | 1645 |
| 1645 @override | 1646 @override |
| 1646 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) { | 1647 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) { |
| 1647 Map<String, int> filePaths = currentContextFilePaths[contextFolder.path]; | 1648 Map<String, int> filePaths = currentContextFilePaths[contextFolder.path]; |
| 1648 Set<Source> sources = currentContextSources[contextFolder.path]; | 1649 Set<Source> sources = currentContextSources[contextFolder.path]; |
| 1649 | 1650 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 class TestUriResolver extends UriResolver { | 1719 class TestUriResolver extends UriResolver { |
| 1719 Map<Uri, Source> uriMap; | 1720 Map<Uri, Source> uriMap; |
| 1720 | 1721 |
| 1721 TestUriResolver(this.uriMap); | 1722 TestUriResolver(this.uriMap); |
| 1722 | 1723 |
| 1723 @override | 1724 @override |
| 1724 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 1725 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 1725 return uriMap[uri]; | 1726 return uriMap[uri]; |
| 1726 } | 1727 } |
| 1727 } | 1728 } |
| OLD | NEW |