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

Side by Side Diff: pkg/analysis_server/lib/src/services/index/store/codec.dart

Issue 877693004: Fix for file:// package: references to the same element. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/index/store/codec_test.dart » ('j') | 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) 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 services.src.index.store.codec; 5 library services.src.index.store.codec;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analysis_server/src/services/index/index.dart'; 9 import 'package:analysis_server/src/services/index/index.dart';
10 import 'package:analysis_server/src/services/index/store/collection.dart'; 10 import 'package:analysis_server/src/services/index/store/collection.dart';
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 */ 175 */
176 List<int> _getLocationPath(Element element, ElementLocation location, 176 List<int> _getLocationPath(Element element, ElementLocation location,
177 bool usePath) { 177 bool usePath) {
178 // prepare the location components 178 // prepare the location components
179 List<String> components = location.components; 179 List<String> components = location.components;
180 if (usePath) { 180 if (usePath) {
181 LibraryElement library = element.library; 181 LibraryElement library = element.library;
182 if (library != null) { 182 if (library != null) {
183 components = components.toList(); 183 components = components.toList();
184 components[0] = library.source.fullName; 184 components[0] = library.source.fullName;
185 if (element.enclosingElement is CompilationUnitElement) { 185 for (Element e = element; e != null; e = e.enclosingElement) {
Brian Wilkerson 2015/01/26 19:07:15 Or perhaps: CompilationUnitElement unit = eleme
186 components[1] = library.definingCompilationUnit.source.fullName; 186 if (e is CompilationUnitElement) {
187 components[1] = e.source.fullName;
188 break;
189 }
187 } 190 }
188 } 191 }
189 } 192 }
190 // encode the location 193 // encode the location
191 int length = components.length; 194 int length = components.length;
192 if (_hasLocalOffset(components)) { 195 if (_hasLocalOffset(components)) {
193 List<int> path = new List<int>(); 196 List<int> path = new List<int>();
194 for (String component in components) { 197 for (String component in components) {
195 int atOffset = component.indexOf('@'); 198 int atOffset = component.indexOf('@');
196 if (atOffset == -1) { 199 if (atOffset == -1) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 int encode(String name) { 291 int encode(String name) {
289 int index = nameToIndex[name]; 292 int index = nameToIndex[name];
290 if (index == null) { 293 if (index == null) {
291 index = _indexToName.length; 294 index = _indexToName.length;
292 nameToIndex[name] = index; 295 nameToIndex[name] = index;
293 _indexToName.add(name); 296 _indexToName.add(name);
294 } 297 }
295 return index; 298 return index;
296 } 299 }
297 } 300 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/index/store/codec_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698