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

Unified Diff: pkg/analyzer/test/generated/incremental_resolver_test.dart

Issue 1374943005: Fix for 'implemented' notification after an incremental change. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Put new content into 'testCode'. Created 5 years, 3 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
Index: pkg/analyzer/test/generated/incremental_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/incremental_resolver_test.dart b/pkg/analyzer/test/generated/incremental_resolver_test.dart
index 18a45f63bdf4877412ea5f3dfa4d02aad756c255..21b30359d2d7bf403b816f3aefb07c802576b5d4 100644
--- a/pkg/analyzer/test/generated/incremental_resolver_test.dart
+++ b/pkg/analyzer/test/generated/incremental_resolver_test.dart
@@ -4091,6 +4091,28 @@ foo(String p) {}
''');
}
+ void test_true_todoHint() {
+ _resolveUnit(r'''
+main() {
+ print(1);
+}
+foo() {
+ // TODO
+}
+''');
+ List<AnalysisError> oldErrors = analysisContext.computeErrors(source);
+ _updateAndValidate(r'''
+main() {
+ print(2);
+}
+foo() {
+ // TODO
+}
+''');
+ List<AnalysisError> newErrors = analysisContext.computeErrors(source);
+ _assertEqualErrors(newErrors, oldErrors);
+ }
+
void test_true_wholeConstructor() {
_resolveUnit(r'''
class A {
@@ -4168,28 +4190,6 @@ class A {
''');
}
- void test_true_todoHint() {
- _resolveUnit(r'''
-main() {
- print(1);
-}
-foo() {
- // TODO
-}
-''');
- List<AnalysisError> oldErrors = analysisContext.computeErrors(source);
- _updateAndValidate(r'''
-main() {
- print(2);
-}
-foo() {
- // TODO
-}
-''');
- List<AnalysisError> newErrors = analysisContext.computeErrors(source);
- _assertEqualErrors(newErrors, oldErrors);
- }
-
void test_unusedHint_add_wasUsedOnlyInPart() {
Source partSource = addNamedSource(
'/my_unit.dart',
@@ -4440,6 +4440,36 @@ f3() {
''');
}
+ void test_whitespace_getElementAt() {
+ _resolveUnit(r'''
+class A {}
+class B extends A {}
+''');
+ {
+ ClassElement typeA = oldUnitElement.getType('A');
+ expect(oldUnitElement.getElementAt(typeA.nameOffset), typeA);
+ }
+ {
+ ClassElement typeB = oldUnitElement.getType('B');
+ expect(oldUnitElement.getElementAt(typeB.nameOffset), typeB);
+ }
+ _updateAndValidate(r'''
+class A {}
+
+class B extends A {}
+''');
+ // getElementAt() caches results, it should be notificed it when offset
+ // are changed.
+ {
+ ClassElement typeA = oldUnitElement.getType('A');
+ expect(oldUnitElement.getElementAt(typeA.nameOffset), typeA);
+ }
+ {
+ ClassElement typeB = oldUnitElement.getType('B');
+ expect(oldUnitElement.getElementAt(typeB.nameOffset), typeB);
+ }
+ }
+
void _assertEqualLineInfo(LineInfo incrLineInfo, LineInfo fullLineInfo) {
for (int offset = 0; offset < 1000; offset++) {
LineInfo_Location incrLocation = incrLineInfo.getLocation(offset);

Powered by Google App Engine
This is Rietveld 408576698