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

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

Issue 907483004: Handle exception and clean-up code (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/analyzer/lib/source/package_map_resolver.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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 * Returns an [Element] that corresponds to the given location. 86 * Returns an [Element] that corresponds to the given location.
87 * 87 *
88 * @param context the [AnalysisContext] to find [Element] in 88 * @param context the [AnalysisContext] to find [Element] in
89 * @param index an integer corresponding to the [Element] 89 * @param index an integer corresponding to the [Element]
90 * @return the [Element] or `null` 90 * @return the [Element] or `null`
91 */ 91 */
92 Element decode(AnalysisContext context, int index) { 92 Element decode(AnalysisContext context, int index) {
93 List<int> path = _indexToPath[index]; 93 List<int> path = _indexToPath[index];
94 List<String> components = _getLocationComponents(path); 94 List<String> components = _getLocationComponents(path);
95 ElementLocation location = new ElementLocationImpl.con3(components); 95 ElementLocation location = new ElementLocationImpl.con3(components);
96 Element element = context.getElement(location); 96 return context.getElement(location);
97 return element;
98 } 97 }
99 98
100 /** 99 /**
101 * Returns a unique integer that corresponds to the given [Element]. 100 * Returns a unique integer that corresponds to the given [Element].
102 * 101 *
103 * If [forKey] is `true` then [element] is a part of a key, so it should use 102 * If [forKey] is `true` then [element] is a part of a key, so it should use
104 * file paths instead of [Element] location URIs. 103 * file paths instead of [Element] location URIs.
105 */ 104 */
106 int encode(Element element, bool forKey) { 105 int encode(Element element, bool forKey) {
107 ElementLocationImpl location = element.location; 106 ElementLocationImpl location = element.location;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 int encode(String name) { 318 int encode(String name) {
320 int index = nameToIndex[name]; 319 int index = nameToIndex[name];
321 if (index == null) { 320 if (index == null) {
322 index = _indexToName.length; 321 index = _indexToName.length;
323 nameToIndex[name] = index; 322 nameToIndex[name] = index;
324 _indexToName.add(name); 323 _indexToName.add(name);
325 } 324 }
326 return index; 325 return index;
327 } 326 }
328 } 327 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/source/package_map_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698