Index: pkg/analyzer/test/src/dart/element/element_test.dart |
diff --git a/pkg/analyzer/test/src/dart/element/element_test.dart b/pkg/analyzer/test/src/dart/element/element_test.dart |
index c097cff672ac2e63dedac7b87049947e558d76c9..b93ba35a0d59bfe3751af6b05a862c3a27d47730 100644 |
--- a/pkg/analyzer/test/src/dart/element/element_test.dart |
+++ b/pkg/analyzer/test/src/dart/element/element_test.dart |
@@ -8,6 +8,7 @@ import 'package:analyzer/dart/ast/ast.dart'; |
import 'package:analyzer/dart/element/element.dart'; |
import 'package:analyzer/dart/element/type.dart'; |
import 'package:analyzer/src/dart/element/element.dart'; |
+import 'package:analyzer/src/dart/element/handle.dart'; |
import 'package:analyzer/src/dart/element/type.dart'; |
import 'package:analyzer/src/generated/engine.dart' |
show AnalysisContext, AnalysisOptionsImpl; |
@@ -3703,6 +3704,24 @@ class LibraryElementImplTest extends EngineTestCase { |
library.visibleLibraries, unorderedEquals(<LibraryElement>[library])); |
} |
+ void test_invalidateLibraryCycles_withHandle() { |
+ AnalysisContext context = createAnalysisContext(); |
+ context.sourceFactory = new SourceFactory([]); |
+ LibraryElementImpl library = ElementFactory.library(context, "foo"); |
+ LibraryElementImpl importedLibrary = ElementFactory.library(context, "bar"); |
+ ElementLocation location = new ElementLocationImpl.con2(''); |
+ TestElementResynthesizer resynthesizer = |
+ new TestElementResynthesizer(context, {location: importedLibrary}); |
+ LibraryElement importedLibraryHandle = |
+ new LibraryElementHandle(resynthesizer, location); |
+ ImportElementImpl import = |
+ ElementFactory.importFor(importedLibraryHandle, null); |
+ library.imports = <ImportElement>[import]; |
+ library.libraryCycle; // Force computation of the cycle. |
+ |
+ library.invalidateLibraryCycles(); |
+ } |
+ |
void test_isUpToDate() { |
AnalysisContext context = createAnalysisContext(); |
context.sourceFactory = new SourceFactory([]); |
@@ -3938,6 +3957,18 @@ main(int p) { |
} |
} |
+class TestElementResynthesizer extends ElementResynthesizer { |
+ Map<ElementLocation, Element> locationMap; |
+ |
+ TestElementResynthesizer(AnalysisContext context, this.locationMap) |
+ : super(context); |
+ |
+ @override |
+ Element getElement(ElementLocation location) { |
+ return locationMap[location]; |
+ } |
+} |
+ |
@reflectiveTest |
class TypeParameterTypeImplTest extends EngineTestCase { |
void test_creation() { |