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

Unified Diff: pkg/analyzer/test/src/dart/element/element_test.dart

Issue 1810393002: Fix unguarded cast to an impl class (issue 26035) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698