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/analyzer/lib/src/summary/index_unit.dart

Issue 2203173002: Use unitMember/classMember/parameter names instead of offsets in index. (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) 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:analyzer/dart/ast/ast.dart'; 5 import 'package:analyzer/dart/ast/ast.dart';
6 import 'package:analyzer/dart/ast/token.dart'; 6 import 'package:analyzer/dart/ast/token.dart';
7 import 'package:analyzer/dart/ast/visitor.dart'; 7 import 'package:analyzer/dart/ast/visitor.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/dart/element/type.dart'; 9 import 'package:analyzer/dart/element/type.dart';
10 import 'package:analyzer/src/dart/element/member.dart'; 10 import 'package:analyzer/src/dart/element/member.dart';
11 import 'package:analyzer/src/generated/utilities_dart.dart'; 11 import 'package:analyzer/src/generated/utilities_dart.dart';
12 import 'package:analyzer/src/summary/format.dart'; 12 import 'package:analyzer/src/summary/format.dart';
13 import 'package:analyzer/src/summary/idl.dart'; 13 import 'package:analyzer/src/summary/idl.dart';
14 14
15 /** 15 /**
16 * Information about an element referenced in index. 16 * Information about an element that is actually put into index for some other
17 * related element. For example for a synthetic getter this is the corresponding
18 * non-synthetic field and [IndexSyntheticElementKind.getter] as the [kind].
17 */ 19 */
18 class ElementInfo { 20 class IndexElementInfo {
19 /** 21 final Element element;
20 * The identifier of the [CompilationUnitElement] containing this element.
21 */
22 final int unitId;
23
24 /**
25 * The name offset of the element.
26 */
27 final int offset;
28
29 /**
30 * The kind of the element.
31 */
32 final IndexSyntheticElementKind kind; 22 final IndexSyntheticElementKind kind;
33 23
34 /** 24 factory IndexElementInfo(Element element) {
35 * The unique id of the element. It is set after indexing of the whole 25 IndexSyntheticElementKind kind = IndexSyntheticElementKind.notSynthetic;
36 * package is done and we are assembling the full package index. 26 if (element.isSynthetic) {
37 */ 27 if (element is ConstructorElement) {
38 int id; 28 kind = IndexSyntheticElementKind.constructor;
29 element = element.enclosingElement;
30 } else if (element is FunctionElement && element.name == 'loadLibrary') {
31 kind = IndexSyntheticElementKind.loadLibrary;
32 element = element.library;
33 } else if (element is FieldElement) {
34 FieldElement field = element;
35 kind = IndexSyntheticElementKind.field;
36 element = field.getter;
37 element ??= field.setter;
38 } else if (element is PropertyAccessorElement) {
39 PropertyAccessorElement accessor = element;
40 Element enclosing = element.enclosingElement;
41 bool isEnumGetter = enclosing is ClassElement && enclosing.isEnum;
42 if (isEnumGetter && accessor.name == 'index') {
43 kind = IndexSyntheticElementKind.enumIndex;
44 element = enclosing;
45 } else if (isEnumGetter && accessor.name == 'values') {
46 kind = IndexSyntheticElementKind.enumValues;
47 element = enclosing;
48 } else {
49 kind = accessor.isGetter
50 ? IndexSyntheticElementKind.getter
51 : IndexSyntheticElementKind.setter;
52 element = accessor.variable;
53 }
54 } else if (element is TopLevelVariableElement) {
55 TopLevelVariableElement property = element;
56 kind = IndexSyntheticElementKind.topLevelVariable;
57 element = property.getter;
58 element ??= property.setter;
59 } else {
60 throw new ArgumentError(
61 'Unsupported synthetic element ${element.runtimeType}');
62 }
63 } else if (element is LibraryElement || element is CompilationUnitElement) {
64 kind = IndexSyntheticElementKind.unit;
65 }
66 return new IndexElementInfo._(element, kind);
67 }
39 68
40 ElementInfo(this.unitId, this.offset, this.kind) { 69 IndexElementInfo._(this.element, this.kind);
41 assert(offset >= 0);
42 }
43 } 70 }
44 71
45 /** 72 /**
46 * Object that gathers information about the whole package index and then uses 73 * Object that gathers information about the whole package index and then uses
47 * it to assemble a new [PackageIndexBuilder]. Call [index] on each compilation 74 * it to assemble a new [PackageIndexBuilder]. Call [indexUnit] on each
48 * unit to be indexed, then call [assemble] to retrieve the complete index for 75 * compilation unit to be indexed, then call [assemble] to retrieve the
49 * the package. 76 * complete index for the package.
50 */ 77 */
51 class PackageIndexAssembler { 78 class PackageIndexAssembler {
52 /** 79 /**
53 * Map associating referenced elements with their [ElementInfo]s. 80 * The string to use place of the `null` string.
54 */ 81 */
55 final Map<Element, ElementInfo> _elementMap = <Element, ElementInfo>{}; 82 static const NULL_STRING = '--nullString--';
83
84 /**
85 * Map associating referenced elements with their [_ElementInfo]s.
86 */
87 final Map<Element, _ElementInfo> _elementMap = <Element, _ElementInfo>{};
56 88
57 /** 89 /**
58 * Map associating [CompilationUnitElement]s with their identifiers, which 90 * Map associating [CompilationUnitElement]s with their identifiers, which
59 * are indices into [_unitLibraryUris] and [_unitUnitUris]. 91 * are indices into [_unitLibraryUris] and [_unitUnitUris].
60 */ 92 */
61 final Map<CompilationUnitElement, int> _unitMap = 93 final Map<CompilationUnitElement, int> _unitMap =
62 <CompilationUnitElement, int>{}; 94 <CompilationUnitElement, int>{};
63 95
64 /** 96 /**
65 * Each item of this list corresponds to the library URI of a unique 97 * Each item of this list corresponds to the library URI of a unique
(...skipping 11 matching lines...) Expand all
77 * Map associating strings with their [_StringInfo]s. 109 * Map associating strings with their [_StringInfo]s.
78 */ 110 */
79 final Map<String, _StringInfo> _stringMap = <String, _StringInfo>{}; 111 final Map<String, _StringInfo> _stringMap = <String, _StringInfo>{};
80 112
81 /** 113 /**
82 * List of information about each unit indexed in this index. 114 * List of information about each unit indexed in this index.
83 */ 115 */
84 final List<_UnitIndexAssembler> _units = <_UnitIndexAssembler>[]; 116 final List<_UnitIndexAssembler> _units = <_UnitIndexAssembler>[];
85 117
86 /** 118 /**
119 * The [_StringInfo] to use for `null` strings.
120 */
121 _StringInfo _nullString;
122
123 PackageIndexAssembler() {
124 _nullString = _getStringInfo(NULL_STRING);
125 }
126
127 /**
87 * Assemble a new [PackageIndexBuilder] using the information gathered by 128 * Assemble a new [PackageIndexBuilder] using the information gathered by
88 * [indexDeclarations] or [indexUnit]. 129 * [indexDeclarations] or [indexUnit].
89 */ 130 */
90 PackageIndexBuilder assemble() { 131 PackageIndexBuilder assemble() {
91 // sort strings end set IDs 132 // sort strings end set IDs
92 List<_StringInfo> stringInfoList = _stringMap.values.toList(); 133 List<_StringInfo> stringInfoList = _stringMap.values.toList();
93 stringInfoList.sort((a, b) { 134 stringInfoList.sort((a, b) {
94 return a.value.compareTo(b.value); 135 return a.value.compareTo(b.value);
95 }); 136 });
96 for (int i = 0; i < stringInfoList.length; i++) { 137 for (int i = 0; i < stringInfoList.length; i++) {
97 stringInfoList[i].id = i; 138 stringInfoList[i].id = i;
98 } 139 }
99 // sort elements and set IDs 140 // sort elements and set IDs
100 List<ElementInfo> elementInfoList = _elementMap.values.toList(); 141 List<_ElementInfo> elementInfoList = _elementMap.values.toList();
101 elementInfoList.sort((a, b) { 142 elementInfoList.sort((a, b) {
102 return a.offset - b.offset; 143 int delta;
144 delta = a.nameIdUnitMember.id - b.nameIdUnitMember.id;
145 if (delta != null) {
146 return delta;
147 }
148 delta = a.nameIdClassMember.id - b.nameIdClassMember.id;
149 if (delta != null) {
150 return delta;
151 }
152 return a.nameIdParameter.id - b.nameIdParameter.id;
103 }); 153 });
104 for (int i = 0; i < elementInfoList.length; i++) { 154 for (int i = 0; i < elementInfoList.length; i++) {
105 elementInfoList[i].id = i; 155 elementInfoList[i].id = i;
106 } 156 }
107 return new PackageIndexBuilder( 157 return new PackageIndexBuilder(
108 unitLibraryUris: _unitLibraryUris.map((s) => s.id).toList(), 158 unitLibraryUris: _unitLibraryUris.map((s) => s.id).toList(),
109 unitUnitUris: _unitUnitUris.map((s) => s.id).toList(), 159 unitUnitUris: _unitUnitUris.map((s) => s.id).toList(),
110 elementUnits: elementInfoList.map((e) => e.unitId).toList(), 160 elementUnits: elementInfoList.map((e) => e.unitId).toList(),
111 elementOffsets: elementInfoList.map((e) => e.offset).toList(), 161 elementNameUnitMemberIds:
162 elementInfoList.map((e) => e.nameIdUnitMember.id).toList(),
163 elementNameClassMemberIds:
164 elementInfoList.map((e) => e.nameIdClassMember.id).toList(),
165 elementNameParameterIds:
166 elementInfoList.map((e) => e.nameIdParameter.id).toList(),
112 elementKinds: elementInfoList.map((e) => e.kind).toList(), 167 elementKinds: elementInfoList.map((e) => e.kind).toList(),
113 strings: stringInfoList.map((s) => s.value).toList(), 168 strings: stringInfoList.map((s) => s.value).toList(),
114 units: _units.map((unit) => unit.assemble()).toList()); 169 units: _units.map((unit) => unit.assemble()).toList());
115 } 170 }
116 171
117 /** 172 /**
118 * Index declarations in the given partially resolved [unit]. 173 * Index declarations in the given partially resolved [unit].
119 */ 174 */
120 void indexDeclarations(CompilationUnit unit) { 175 void indexDeclarations(CompilationUnit unit) {
121 int unitId = _getUnitId(unit.element); 176 int unitId = _getUnitId(unit.element);
122 _UnitIndexAssembler assembler = new _UnitIndexAssembler(this, unitId); 177 _UnitIndexAssembler assembler = new _UnitIndexAssembler(this, unitId);
123 _units.add(assembler); 178 _units.add(assembler);
124 unit.accept(new _IndexDeclarationContributor(assembler)); 179 unit.accept(new _IndexDeclarationContributor(assembler));
125 } 180 }
126 181
127 /** 182 /**
128 * Index the given fully resolved [unit]. 183 * Index the given fully resolved [unit].
129 */ 184 */
130 void indexUnit(CompilationUnit unit) { 185 void indexUnit(CompilationUnit unit) {
131 int unitId = _getUnitId(unit.element); 186 int unitId = _getUnitId(unit.element);
132 _UnitIndexAssembler assembler = new _UnitIndexAssembler(this, unitId); 187 _UnitIndexAssembler assembler = new _UnitIndexAssembler(this, unitId);
133 _units.add(assembler); 188 _units.add(assembler);
134 unit.accept(new _IndexContributor(assembler)); 189 unit.accept(new _IndexContributor(assembler));
135 } 190 }
136 191
137 /** 192 /**
138 * Return the unique [ElementInfo] corresponding the [element]. The field 193 * Return the unique [_ElementInfo] corresponding the [element]. The field
139 * [ElementInfo.id] is filled by [assemble] during final sorting. 194 * [_ElementInfo.id] is filled by [assemble] during final sorting.
140 */ 195 */
141 ElementInfo _getElementInfo(Element element) { 196 _ElementInfo _getElementInfo(Element element) {
142 if (element is Member) { 197 if (element is Member) {
143 element = (element as Member).baseElement; 198 element = (element as Member).baseElement;
144 } 199 }
145 return _elementMap.putIfAbsent(element, () { 200 return _elementMap.putIfAbsent(element, () {
146 CompilationUnitElement unitElement = getUnitElement(element); 201 CompilationUnitElement unitElement = getUnitElement(element);
147 int unitId = _getUnitId(unitElement); 202 int unitId = _getUnitId(unitElement);
148 return newElementInfo(unitId, element); 203 return _newElementInfo(unitId, element);
149 }); 204 });
150 } 205 }
151 206
152 /** 207 /**
153 * Return the unique [_StringInfo] corresponding the [str]. The field 208 * Return the unique [_StringInfo] corresponding the [str]. The field
154 * [_StringInfo.id] is filled by [assemble] during final sorting. 209 * [_StringInfo.id] is filled by [assemble] during final sorting.
155 */ 210 */
156 _StringInfo _getStringInfo(String str) { 211 _StringInfo _getStringInfo(String str) {
157 return _stringMap.putIfAbsent(str, () { 212 return _stringMap.putIfAbsent(str, () {
158 return new _StringInfo(str); 213 return new _StringInfo(str);
(...skipping 18 matching lines...) Expand all
177 /** 232 /**
178 * Return the unique [_StringInfo] corresponding [uri]. The field 233 * Return the unique [_StringInfo] corresponding [uri]. The field
179 * [_StringInfo.id] is filled by [assemble] during final sorting. 234 * [_StringInfo.id] is filled by [assemble] during final sorting.
180 */ 235 */
181 _StringInfo _getUriInfo(Uri uri) { 236 _StringInfo _getUriInfo(Uri uri) {
182 String str = uri.toString(); 237 String str = uri.toString();
183 return _getStringInfo(str); 238 return _getStringInfo(str);
184 } 239 }
185 240
186 /** 241 /**
242 * Return a new [_ElementInfo] for the given [element] in the given [unitId].
243 * This method is static, so it cannot add any information to the index.
244 */
245 _ElementInfo _newElementInfo(int unitId, Element element) {
246 IndexElementInfo info = new IndexElementInfo(element);
247 element = info.element;
248 // Prepare name identifiers.
249 _StringInfo nameIdParameter = _nullString;
250 _StringInfo nameIdClassMember = _nullString;
251 _StringInfo nameIdUnitMember = _nullString;
252 if (element is ParameterElement) {
253 nameIdParameter = _getStringInfo(element.name);
254 element = element.enclosingElement;
255 }
256 if (element?.enclosingElement is ClassElement) {
257 nameIdClassMember = _getStringInfo(element.name);
258 element = element.enclosingElement;
259 }
260 if (element?.enclosingElement is CompilationUnitElement) {
261 nameIdUnitMember = _getStringInfo(element.name);
262 }
263 return new _ElementInfo(unitId, nameIdUnitMember, nameIdClassMember,
264 nameIdParameter, info.kind);
265 }
266
267 /**
187 * Return the [CompilationUnitElement] that should be used for [element]. 268 * Return the [CompilationUnitElement] that should be used for [element].
188 * Throw [StateError] if the [element] is not linked into a unit. 269 * Throw [StateError] if the [element] is not linked into a unit.
189 */ 270 */
190 static CompilationUnitElement getUnitElement(Element element) { 271 static CompilationUnitElement getUnitElement(Element element) {
191 for (Element e = element; e != null; e = e.enclosingElement) { 272 for (Element e = element; e != null; e = e.enclosingElement) {
192 if (e is CompilationUnitElement) { 273 if (e is CompilationUnitElement) {
193 return e; 274 return e;
194 } 275 }
195 if (e is LibraryElement) { 276 if (e is LibraryElement) {
196 return e.definingCompilationUnit; 277 return e.definingCompilationUnit;
197 } 278 }
198 } 279 }
199 throw new StateError(element.toString()); 280 throw new StateError(element.toString());
200 } 281 }
201
202 /**
203 * Return a new [ElementInfo] for the given [element] in the given [unitId].
204 * This method is static, so it cannot add any information to the index.
205 */
206 static ElementInfo newElementInfo(int unitId, Element element) {
207 int offset = null;
208 IndexSyntheticElementKind kind = IndexSyntheticElementKind.notSynthetic;
209 if (element.isSynthetic) {
210 if (element is ConstructorElement) {
211 kind = IndexSyntheticElementKind.constructor;
212 element = element.enclosingElement;
213 } else if (element is FunctionElement && element.name == 'loadLibrary') {
214 kind = IndexSyntheticElementKind.loadLibrary;
215 element = element.library;
216 } else if (element is FieldElement) {
217 FieldElement field = element;
218 kind = IndexSyntheticElementKind.field;
219 element = field.getter;
220 element ??= field.setter;
221 } else if (element is PropertyAccessorElement) {
222 PropertyAccessorElement accessor = element;
223 Element enclosing = element.enclosingElement;
224 bool isEnumGetter = enclosing is ClassElement && enclosing.isEnum;
225 if (isEnumGetter && accessor.name == 'index') {
226 kind = IndexSyntheticElementKind.enumIndex;
227 element = enclosing;
228 } else if (isEnumGetter && accessor.name == 'values') {
229 kind = IndexSyntheticElementKind.enumValues;
230 element = enclosing;
231 } else {
232 kind = accessor.isGetter
233 ? IndexSyntheticElementKind.getter
234 : IndexSyntheticElementKind.setter;
235 element = accessor.variable;
236 }
237 } else if (element is TopLevelVariableElement) {
238 TopLevelVariableElement property = element;
239 kind = IndexSyntheticElementKind.topLevelVariable;
240 element = property.getter;
241 element ??= property.setter;
242 } else {
243 throw new ArgumentError(
244 'Unsupported synthetic element ${element.runtimeType}');
245 }
246 } else if (element is LibraryElement || element is CompilationUnitElement) {
247 kind = IndexSyntheticElementKind.unit;
248 offset = 0;
249 }
250 offset ??= element.nameOffset;
251 return new ElementInfo(unitId, offset, kind);
252 }
253 } 282 }
254 283
255 /** 284 /**
256 * Information about a single defined name. Any [_DefinedNameInfo] is always 285 * Information about a single defined name. Any [_DefinedNameInfo] is always
257 * part of a [_UnitIndexAssembler], so [offset] should be understood within the 286 * part of a [_UnitIndexAssembler], so [offset] should be understood within the
258 * context of the compilation unit pointed to by the [_UnitIndexAssembler]. 287 * context of the compilation unit pointed to by the [_UnitIndexAssembler].
259 */ 288 */
260 class _DefinedNameInfo { 289 class _DefinedNameInfo {
261 /** 290 /**
262 * The information about the name returned from 291 * The information about the name returned from
263 * [PackageIndexAssembler._getStringInfo]. 292 * [PackageIndexAssembler._getStringInfo].
264 */ 293 */
265 final _StringInfo nameInfo; 294 final _StringInfo nameInfo;
266 295
267 /** 296 /**
268 * The coarse-grained kind of the defined name. 297 * The coarse-grained kind of the defined name.
269 */ 298 */
270 final IndexNameKind kind; 299 final IndexNameKind kind;
271 300
272 /** 301 /**
273 * The name offset of the defined element. 302 * The name offset of the defined element.
274 */ 303 */
275 final int offset; 304 final int offset;
276 305
277 _DefinedNameInfo(this.nameInfo, this.kind, this.offset); 306 _DefinedNameInfo(this.nameInfo, this.kind, this.offset);
278 } 307 }
279 308
280 /** 309 /**
310 * Information about an element referenced in index.
311 */
312 class _ElementInfo {
313 /**
314 * The identifier of the [CompilationUnitElement] containing this element.
315 */
316 final int unitId;
317
318 /**
319 * The identifier of the top-level name, or `null` if the element is a
320 * reference to the unit.
321 */
322 final _StringInfo nameIdUnitMember;
323
324 /**
325 * The identifier of the class member name, or `null` if the element is not a
326 * class member or a named parameter of a class member.
327 */
328 final _StringInfo nameIdClassMember;
329
330 /**
331 * The identifier of the named parameter name, or `null` if the element is not
332 * a named parameter.
333 */
334 final _StringInfo nameIdParameter;
335
336 /**
337 * The kind of the element.
338 */
339 final IndexSyntheticElementKind kind;
340
341 /**
342 * The unique id of the element. It is set after indexing of the whole
343 * package is done and we are assembling the full package index.
344 */
345 int id;
346
347 _ElementInfo(this.unitId, this.nameIdUnitMember, this.nameIdClassMember,
348 this.nameIdParameter, this.kind);
349 }
350
351 /**
281 * Information about a single relation. Any [_ElementRelationInfo] is always 352 * Information about a single relation. Any [_ElementRelationInfo] is always
282 * part of a [_UnitIndexAssembler], so [offset] and [length] should be 353 * part of a [_UnitIndexAssembler], so [offset] and [length] should be
283 * understood within the context of the compilation unit pointed to by the 354 * understood within the context of the compilation unit pointed to by the
284 * [_UnitIndexAssembler]. 355 * [_UnitIndexAssembler].
285 */ 356 */
286 class _ElementRelationInfo { 357 class _ElementRelationInfo {
287 final ElementInfo elementInfo; 358 final _ElementInfo elementInfo;
288 final IndexRelationKind kind; 359 final IndexRelationKind kind;
289 final int offset; 360 final int offset;
290 final int length; 361 final int length;
291 final bool isQualified; 362 final bool isQualified;
292 363
293 _ElementRelationInfo( 364 _ElementRelationInfo(
294 this.elementInfo, this.kind, this.offset, this.length, this.isQualified); 365 this.elementInfo, this.kind, this.offset, this.length, this.isQualified);
295 } 366 }
296 367
297 /** 368 /**
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 } 834 }
764 835
765 /** 836 /**
766 * Assembler of a single [CompilationUnit] index. The intended usage sequence: 837 * Assembler of a single [CompilationUnit] index. The intended usage sequence:
767 * 838 *
768 * - Call [defineName] for each name defined in the compilation unit. 839 * - Call [defineName] for each name defined in the compilation unit.
769 * - Call [addElementRelation] for each element relation found in the 840 * - Call [addElementRelation] for each element relation found in the
770 * compilation unit. 841 * compilation unit.
771 * - Call [addNameRelation] for each name relation found in the 842 * - Call [addNameRelation] for each name relation found in the
772 * compilation unit. 843 * compilation unit.
773 * - Assign ids to all the [ElementInfo] objects reachable from 844 * - Assign ids to all the [_ElementInfo] objects reachable from
774 * [elementRelations]. 845 * [elementRelations].
775 * - Call [assemble] to produce the final unit index. 846 * - Call [assemble] to produce the final unit index.
776 */ 847 */
777 class _UnitIndexAssembler { 848 class _UnitIndexAssembler {
778 final PackageIndexAssembler pkg; 849 final PackageIndexAssembler pkg;
779 final int unitId; 850 final int unitId;
780 final List<_DefinedNameInfo> definedNames = <_DefinedNameInfo>[]; 851 final List<_DefinedNameInfo> definedNames = <_DefinedNameInfo>[];
781 final List<_ElementRelationInfo> elementRelations = <_ElementRelationInfo>[]; 852 final List<_ElementRelationInfo> elementRelations = <_ElementRelationInfo>[];
782 final List<_NameRelationInfo> nameRelations = <_NameRelationInfo>[]; 853 final List<_NameRelationInfo> nameRelations = <_NameRelationInfo>[];
783 854
784 _UnitIndexAssembler(this.pkg, this.unitId); 855 _UnitIndexAssembler(this.pkg, this.unitId);
785 856
786 void addElementRelation(Element element, IndexRelationKind kind, int offset, 857 void addElementRelation(Element element, IndexRelationKind kind, int offset,
787 int length, bool isQualified) { 858 int length, bool isQualified) {
788 try { 859 try {
789 ElementInfo elementInfo = pkg._getElementInfo(element); 860 _ElementInfo elementInfo = pkg._getElementInfo(element);
790 elementRelations.add(new _ElementRelationInfo( 861 elementRelations.add(new _ElementRelationInfo(
791 elementInfo, kind, offset, length, isQualified)); 862 elementInfo, kind, offset, length, isQualified));
792 } on StateError {} 863 } on StateError {}
793 } 864 }
794 865
795 void addNameRelation( 866 void addNameRelation(
796 String name, IndexRelationKind kind, int offset, bool isQualified) { 867 String name, IndexRelationKind kind, int offset, bool isQualified) {
797 _StringInfo nameId = pkg._getStringInfo(name); 868 _StringInfo nameId = pkg._getStringInfo(name);
798 nameRelations.add(new _NameRelationInfo(nameId, kind, offset, isQualified)); 869 nameRelations.add(new _NameRelationInfo(nameId, kind, offset, isQualified));
799 } 870 }
(...skipping 28 matching lines...) Expand all
828 usedNameOffsets: nameRelations.map((r) => r.offset).toList(), 899 usedNameOffsets: nameRelations.map((r) => r.offset).toList(),
829 usedNameIsQualifiedFlags: 900 usedNameIsQualifiedFlags:
830 nameRelations.map((r) => r.isQualified).toList()); 901 nameRelations.map((r) => r.isQualified).toList());
831 } 902 }
832 903
833 void defineName(String name, IndexNameKind kind, int offset) { 904 void defineName(String name, IndexNameKind kind, int offset) {
834 _StringInfo nameInfo = pkg._getStringInfo(name); 905 _StringInfo nameInfo = pkg._getStringInfo(name);
835 definedNames.add(new _DefinedNameInfo(nameInfo, kind, offset)); 906 definedNames.add(new _DefinedNameInfo(nameInfo, kind, offset));
836 } 907 }
837 } 908 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/test/src/summary/index_unit_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698