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

Side by Side Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2267273004: Use FlushTargetFilter to pre-filter targets before checking their results. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.test.src.context.context_test; 5 library analyzer.test.src.context.context_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 void test_flushResolvedUnit_updateFile_dontNotify() { 1115 void test_flushResolvedUnit_updateFile_dontNotify() {
1116 String oldCode = ''; 1116 String oldCode = '';
1117 String newCode = r''' 1117 String newCode = r'''
1118 import 'dart:async'; 1118 import 'dart:async';
1119 '''; 1119 ''';
1120 String path = '/test.dart'; 1120 String path = '/test.dart';
1121 Source source = resourceProvider.newFile(path, oldCode).createSource(); 1121 Source source = resourceProvider.newFile(path, oldCode).createSource();
1122 context.applyChanges(new ChangeSet()..addedSource(source)); 1122 context.applyChanges(new ChangeSet()..addedSource(source));
1123 context.resolveCompilationUnit2(source, source); 1123 context.resolveCompilationUnit2(source, source);
1124 // Flush all results units. 1124 // Flush all results units.
1125 context.analysisCache.flush((target, result) { 1125 context.analysisCache.flush((target) => true, (target, result) {
1126 if (target.source == source) { 1126 if (target.source == source) {
1127 return RESOLVED_UNIT_RESULTS.contains(result); 1127 return RESOLVED_UNIT_RESULTS.contains(result);
1128 } 1128 }
1129 return false; 1129 return false;
1130 }); 1130 });
1131 // Update the file, but don't notify the context. 1131 // Update the file, but don't notify the context.
1132 resourceProvider.updateFile(path, newCode); 1132 resourceProvider.updateFile(path, newCode);
1133 // Driver must detect that the file was changed and recover. 1133 // Driver must detect that the file was changed and recover.
1134 CompilationUnit unit = context.resolveCompilationUnit2(source, source); 1134 CompilationUnit unit = context.resolveCompilationUnit2(source, source);
1135 expect(unit, isNotNull); 1135 expect(unit, isNotNull);
1136 } 1136 }
1137 1137
1138 void test_flushResolvedUnit_updateFile_dontNotify2() { 1138 void test_flushResolvedUnit_updateFile_dontNotify2() {
1139 String oldCode = r''' 1139 String oldCode = r'''
1140 main() {} 1140 main() {}
1141 '''; 1141 ''';
1142 String newCode = r''' 1142 String newCode = r'''
1143 import 'dart:async'; 1143 import 'dart:async';
1144 main() {} 1144 main() {}
1145 '''; 1145 ''';
1146 String path = '/test.dart'; 1146 String path = '/test.dart';
1147 Source source = resourceProvider.newFile(path, oldCode).createSource(); 1147 Source source = resourceProvider.newFile(path, oldCode).createSource();
1148 context.applyChanges(new ChangeSet()..addedSource(source)); 1148 context.applyChanges(new ChangeSet()..addedSource(source));
1149 context.resolveCompilationUnit2(source, source); 1149 context.resolveCompilationUnit2(source, source);
1150 // Flush all results units. 1150 // Flush all results units.
1151 context.analysisCache.flush((target, result) { 1151 context.analysisCache.flush((target) => true, (target, result) {
1152 if (target.source == source) { 1152 if (target.source == source) {
1153 if (target.source == source) { 1153 if (target.source == source) {
1154 return RESOLVED_UNIT_RESULTS.contains(result); 1154 return RESOLVED_UNIT_RESULTS.contains(result);
1155 } 1155 }
1156 } 1156 }
1157 return false; 1157 return false;
1158 }); 1158 });
1159 // Update the file, but don't notify the context. 1159 // Update the file, but don't notify the context.
1160 resourceProvider.updateFile(path, newCode); 1160 resourceProvider.updateFile(path, newCode);
1161 // Driver must detect that the file was changed and recover. 1161 // Driver must detect that the file was changed and recover.
(...skipping 4088 matching lines...) Expand 10 before | Expand all | Expand 10 after
5250 * Initialize the visitor. 5250 * Initialize the visitor.
5251 */ 5251 */
5252 _ElementGatherer(); 5252 _ElementGatherer();
5253 5253
5254 @override 5254 @override
5255 void visitElement(Element element) { 5255 void visitElement(Element element) {
5256 elements[element] = element; 5256 elements[element] = element;
5257 super.visitElement(element); 5257 super.visitElement(element);
5258 } 5258 }
5259 } 5259 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/context/cache_test.dart ('k') | pkg/analyzer/test/src/task/incremental_element_builder_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698