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); |