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

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

Issue 1522583005: Issue 25238. Update LoclaElement(s) visible ranges during incremental resolution. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 b36d31e2142f4280f59f8de9ae6c900e08102b0b..351e826894ea4f9c168bd8c08d2b7ee50efce534 100644
--- a/pkg/analyzer/test/generated/incremental_resolver_test.dart
+++ b/pkg/analyzer/test/generated/incremental_resolver_test.dart
@@ -4444,8 +4444,10 @@ foo(int p) {}
CacheEntry cacheEntry = cache.get(target);
expect(cacheEntry.getValue(VERIFY_ERRORS), hasLength(2));
cacheEntry.setState(VERIFY_ERRORS, CacheState.INVALID);
- // Don't run tasks, so don't recompute VERIFY_ERRORS before incremental.
- _updateAndValidate(
+ // Perform incremental resolution.
+ _resetWithIncremental(true);
+ analysisContext2.setContents(
+ source,
r'''
main() {
foo(0);
@@ -4454,10 +4456,12 @@ main2() {
foo('bbb');
}
foo(int p) {}
-''',
- runTasksBeforeIncremental: false);
- // Incremental analysis should have left VERIFY_ERRORS invalid,
- // so it was correctly recomputed later during the full analysis.
+''');
+ // VERIFY_ERRORS is still invalid.
+ expect(cacheEntry.getState(VERIFY_ERRORS), CacheState.INVALID);
+ // Continue analysis - run tasks, so recompute VERIFY_ERRORS.
+ _runTasks();
+ expect(cacheEntry.getState(VERIFY_ERRORS), CacheState.VALID);
expect(cacheEntry.getValue(VERIFY_ERRORS), hasLength(1));
}
@@ -4523,6 +4527,47 @@ f3() {
''');
}
+ void test_visibleRange() {
+ _resolveUnit(r'''
+class Test {
+ method1(p1) {
+ var v1;
+ f1() {}
+ return 1;
+ }
+ method2(p2) {
+ var v2;
+ f2() {}
+ return 2;
+ }
+ method3(p3) {
+ var v3;
+ f3() {}
+ return 3;
+ }
+}
+''');
+ _updateAndValidate(r'''
+class Test {
+ method1(p1) {
+ var v1;
+ f1() {}
+ return 1;
+ }
+ method2(p2) {
+ var v2;
+ f2() {}
+ return 2222;
+ }
+ method3(p3) {
+ var v3;
+ f3() {}
+ return 3;
+ }
+}
+''');
+ }
+
void test_whitespace_getElementAt() {
_resolveUnit(r'''
class A {}
@@ -4628,6 +4673,7 @@ class B extends A {}
// Resolve "newCode" from scratch.
if (compareWithFull) {
_resetWithIncremental(false);
+ changeSource(source, '');
changeSource(source, newCode);
_runTasks();
LibraryElement library = resolve2(source);

Powered by Google App Engine
This is Rietveld 408576698