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

Side by Side Diff: pkg/analysis_server/test/services/index2/index2_test.dart

Issue 1776143002: Use the fact that some index lists are sorted. (Closed) Base URL: git@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 unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/index2/index2.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:analysis_server/src/services/index2/index2.dart'; 5 import 'package:analysis_server/src/services/index2/index2.dart';
6 import 'package:analyzer/dart/ast/ast.dart'; 6 import 'package:analyzer/dart/ast/ast.dart';
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/src/generated/source.dart'; 8 import 'package:analyzer/src/generated/source.dart';
9 import 'package:analyzer/src/summary/idl.dart'; 9 import 'package:analyzer/src/summary/idl.dart';
10 import 'package:test_reflective_loader/test_reflective_loader.dart'; 10 import 'package:test_reflective_loader/test_reflective_loader.dart';
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 main(A a, p) { 162 main(A a, p) {
163 a.test(); // a-inv-r-q 163 a.test(); // a-inv-r-q
164 a.test = 1; // a-ref-r-q 164 a.test = 1; // a-ref-r-q
165 a.test += 2; // a-ref-r-q 165 a.test += 2; // a-ref-r-q
166 print(a.test); // a-ref-r-q 166 print(a.test); // a-ref-r-q
167 p.test(); // p-inv-ur-q 167 p.test(); // p-inv-ur-q
168 p.test = 1; // p-ref-ur-q 168 p.test = 1; // p-ref-ur-q
169 p.test += 2; // p-ref-ur-q 169 p.test += 2; // p-ref-ur-q
170 print(p.test); // p-ref-ur-q 170 print(p.test); // p-ref-ur-q
171 print(p.test2); // not requested
171 } 172 }
172 '''); 173 ''');
173 List<Location> locations = 174 List<Location> locations =
174 await index.getUnresolvedMemberReferences('test'); 175 await index.getUnresolvedMemberReferences('test');
175 expect(locations, hasLength(4)); 176 expect(locations, hasLength(4));
176 findLocationTest(locations, 'test(); // p-inv-ur-q'); 177 findLocationTest(locations, 'test(); // p-inv-ur-q');
177 findLocationTest(locations, 'test = 1; // p-ref-ur-q'); 178 findLocationTest(locations, 'test = 1; // p-ref-ur-q');
178 findLocationTest(locations, 'test += 2; // p-ref-ur-q'); 179 findLocationTest(locations, 'test += 2; // p-ref-ur-q');
179 findLocationTest(locations, 'test); // p-ref-ur-q'); 180 findLocationTest(locations, 'test); // p-ref-ur-q');
180 } 181 }
(...skipping 22 matching lines...) Expand all
203 index.indexUnit(testUnit); 204 index.indexUnit(testUnit);
204 } 205 }
205 206
206 Source _indexUnit(String path, String code) { 207 Source _indexUnit(String path, String code) {
207 Source source = addSource(path, code); 208 Source source = addSource(path, code);
208 CompilationUnit unit = resolveLibraryUnit(source); 209 CompilationUnit unit = resolveLibraryUnit(source);
209 index.indexUnit(unit); 210 index.indexUnit(unit);
210 return source; 211 return source;
211 } 212 }
212 } 213 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/index2/index2.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698