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

Side by Side Diff: pkg/analyzer/lib/src/summary/summarize_elements.dart

Issue 1585973004: Use constructor args in favor of summary "encode" functions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 serialization.elements; 5 library serialization.elements;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/dart/element/type.dart'; 9 import 'package:analyzer/src/dart/element/type.dart';
10 import 'package:analyzer/src/generated/resolver.dart'; 10 import 'package:analyzer/src/generated/resolver.dart';
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 final Set<LibraryElement> librariesAddedToTransitiveExportClosure = 133 final Set<LibraryElement> librariesAddedToTransitiveExportClosure =
134 new Set<LibraryElement>(); 134 new Set<LibraryElement>();
135 135
136 /** 136 /**
137 * Map from imported element to the prefix which may be used to refer to that 137 * Map from imported element to the prefix which may be used to refer to that
138 * element; elements for which no prefix is needed are absent from this map. 138 * element; elements for which no prefix is needed are absent from this map.
139 */ 139 */
140 final Map<Element, PrefixElement> prefixMap = <Element, PrefixElement>{}; 140 final Map<Element, PrefixElement> prefixMap = <Element, PrefixElement>{};
141 141
142 _LibrarySerializer(this.libraryElement, this.typeProvider) { 142 _LibrarySerializer(this.libraryElement, this.typeProvider) {
143 dependencies.add(encodePrelinkedDependency()); 143 dependencies.add(new PrelinkedDependencyBuilder());
144 dependencyMap[libraryElement] = 0; 144 dependencyMap[libraryElement] = 0;
145 } 145 }
146 146
147 /** 147 /**
148 * Retrieve the library element for `dart:core`. 148 * Retrieve the library element for `dart:core`.
149 */ 149 */
150 LibraryElement get coreLibrary => typeProvider.objectType.element.library; 150 LibraryElement get coreLibrary => typeProvider.objectType.element.library;
151 151
152 /** 152 /**
153 * Add all classes, enums, typedefs, executables, and top level variables 153 * Add all classes, enums, typedefs, executables, and top level variables
154 * from the given compilation unit [element] to the library summary. 154 * from the given compilation unit [element] to the library summary.
155 * [unitNum] indicates the ordinal position of this compilation unit in the 155 * [unitNum] indicates the ordinal position of this compilation unit in the
156 * library. 156 * library.
157 */ 157 */
158 void addCompilationUnitElements(CompilationUnitElement element, int unitNum) { 158 void addCompilationUnitElements(CompilationUnitElement element, int unitNum) {
159 UnlinkedUnitBuilder b = new UnlinkedUnitBuilder(); 159 UnlinkedUnitBuilder b = new UnlinkedUnitBuilder();
160 referenceMap.clear(); 160 referenceMap.clear();
161 unlinkedReferences = <UnlinkedReferenceBuilder>[encodeUnlinkedReference()]; 161 unlinkedReferences = <UnlinkedReferenceBuilder>[
162 new UnlinkedReferenceBuilder()
163 ];
162 prelinkedReferences = <PrelinkedReferenceBuilder>[ 164 prelinkedReferences = <PrelinkedReferenceBuilder>[
163 encodePrelinkedReference(kind: PrelinkedReferenceKind.classOrEnum) 165 new PrelinkedReferenceBuilder(kind: PrelinkedReferenceKind.classOrEnum)
164 ]; 166 ];
165 List<UnlinkedPublicNameBuilder> names = <UnlinkedPublicNameBuilder>[]; 167 List<UnlinkedPublicNameBuilder> names = <UnlinkedPublicNameBuilder>[];
166 for (PropertyAccessorElement accessor in element.accessors) { 168 for (PropertyAccessorElement accessor in element.accessors) {
167 if (accessor.isPublic) { 169 if (accessor.isPublic) {
168 names.add(encodeUnlinkedPublicName( 170 names.add(new UnlinkedPublicNameBuilder(
169 kind: PrelinkedReferenceKind.topLevelPropertyAccessor, 171 kind: PrelinkedReferenceKind.topLevelPropertyAccessor,
170 name: accessor.name, 172 name: accessor.name,
171 numTypeParameters: accessor.typeParameters.length)); 173 numTypeParameters: accessor.typeParameters.length));
172 } 174 }
173 } 175 }
174 for (ClassElement cls in element.types) { 176 for (ClassElement cls in element.types) {
175 if (cls.isPublic) { 177 if (cls.isPublic) {
176 names.add(encodeUnlinkedPublicName( 178 names.add(new UnlinkedPublicNameBuilder(
177 kind: PrelinkedReferenceKind.classOrEnum, 179 kind: PrelinkedReferenceKind.classOrEnum,
178 name: cls.name, 180 name: cls.name,
179 numTypeParameters: cls.typeParameters.length)); 181 numTypeParameters: cls.typeParameters.length));
180 } 182 }
181 } 183 }
182 for (ClassElement enm in element.enums) { 184 for (ClassElement enm in element.enums) {
183 if (enm.isPublic) { 185 if (enm.isPublic) {
184 names.add(encodeUnlinkedPublicName( 186 names.add(new UnlinkedPublicNameBuilder(
185 kind: PrelinkedReferenceKind.classOrEnum, name: enm.name)); 187 kind: PrelinkedReferenceKind.classOrEnum, name: enm.name));
186 } 188 }
187 } 189 }
188 for (FunctionElement function in element.functions) { 190 for (FunctionElement function in element.functions) {
189 if (function.isPublic) { 191 if (function.isPublic) {
190 names.add(encodeUnlinkedPublicName( 192 names.add(new UnlinkedPublicNameBuilder(
191 kind: PrelinkedReferenceKind.topLevelFunction, 193 kind: PrelinkedReferenceKind.topLevelFunction,
192 name: function.name, 194 name: function.name,
193 numTypeParameters: function.typeParameters.length)); 195 numTypeParameters: function.typeParameters.length));
194 } 196 }
195 } 197 }
196 for (FunctionTypeAliasElement typedef in element.functionTypeAliases) { 198 for (FunctionTypeAliasElement typedef in element.functionTypeAliases) {
197 if (typedef.isPublic) { 199 if (typedef.isPublic) {
198 names.add(encodeUnlinkedPublicName( 200 names.add(new UnlinkedPublicNameBuilder(
199 kind: PrelinkedReferenceKind.typedef, 201 kind: PrelinkedReferenceKind.typedef,
200 name: typedef.name, 202 name: typedef.name,
201 numTypeParameters: typedef.typeParameters.length)); 203 numTypeParameters: typedef.typeParameters.length));
202 } 204 }
203 } 205 }
204 if (unitNum == 0) { 206 if (unitNum == 0) {
205 if (libraryElement.name.isNotEmpty) { 207 if (libraryElement.name.isNotEmpty) {
206 b.libraryName = libraryElement.name; 208 b.libraryName = libraryElement.name;
207 b.libraryNameOffset = libraryElement.nameOffset; 209 b.libraryNameOffset = libraryElement.nameOffset;
208 b.libraryNameLength = libraryElement.nameLength; 210 b.libraryNameLength = libraryElement.nameLength;
209 b.libraryDocumentationComment = serializeDocumentation(libraryElement); 211 b.libraryDocumentationComment = serializeDocumentation(libraryElement);
210 } 212 }
211 b.publicNamespace = encodeUnlinkedPublicNamespace( 213 b.publicNamespace = new UnlinkedPublicNamespaceBuilder(
212 exports: libraryElement.exports.map(serializeExportPublic).toList(), 214 exports: libraryElement.exports.map(serializeExportPublic).toList(),
213 parts: libraryElement.parts 215 parts: libraryElement.parts
214 .map((CompilationUnitElement e) => e.uri) 216 .map((CompilationUnitElement e) => e.uri)
215 .toList(), 217 .toList(),
216 names: names); 218 names: names);
217 b.exports = libraryElement.exports.map(serializeExportNonPublic).toList(); 219 b.exports = libraryElement.exports.map(serializeExportNonPublic).toList();
218 b.imports = libraryElement.imports.map(serializeImport).toList(); 220 b.imports = libraryElement.imports.map(serializeImport).toList();
219 b.parts = libraryElement.parts 221 b.parts = libraryElement.parts
220 .map((CompilationUnitElement e) => 222 .map((CompilationUnitElement e) =>
221 encodeUnlinkedPart(uriOffset: e.uriOffset, uriEnd: e.uriEnd)) 223 new UnlinkedPartBuilder(uriOffset: e.uriOffset, uriEnd: e.uriEnd))
222 .toList(); 224 .toList();
223 } else { 225 } else {
224 // TODO(paulberry): we need to figure out a way to record library, part, 226 // TODO(paulberry): we need to figure out a way to record library, part,
225 // import, and export declarations that appear in non-defining 227 // import, and export declarations that appear in non-defining
226 // compilation units (even though such declarations are prohibited by the 228 // compilation units (even though such declarations are prohibited by the
227 // language), so that if the user makes code changes that cause a 229 // language), so that if the user makes code changes that cause a
228 // non-defining compilation unit to become a defining compilation unit, 230 // non-defining compilation unit to become a defining compilation unit,
229 // we can create a correct summary by simply re-linking. 231 // we can create a correct summary by simply re-linking.
230 b.publicNamespace = encodeUnlinkedPublicNamespace(names: names); 232 b.publicNamespace = new UnlinkedPublicNamespaceBuilder(names: names);
231 } 233 }
232 b.classes = element.types.map(serializeClass).toList(); 234 b.classes = element.types.map(serializeClass).toList();
233 b.enums = element.enums.map(serializeEnum).toList(); 235 b.enums = element.enums.map(serializeEnum).toList();
234 b.typedefs = element.functionTypeAliases.map(serializeTypedef).toList(); 236 b.typedefs = element.functionTypeAliases.map(serializeTypedef).toList();
235 List<UnlinkedExecutableBuilder> executables = 237 List<UnlinkedExecutableBuilder> executables =
236 element.functions.map(serializeExecutable).toList(); 238 element.functions.map(serializeExecutable).toList();
237 for (PropertyAccessorElement accessor in element.accessors) { 239 for (PropertyAccessorElement accessor in element.accessors) {
238 if (!accessor.isSynthetic) { 240 if (!accessor.isSynthetic) {
239 executables.add(serializeExecutable(accessor)); 241 executables.add(serializeExecutable(accessor));
240 } 242 }
241 } 243 }
242 b.executables = executables; 244 b.executables = executables;
243 List<UnlinkedVariableBuilder> variables = <UnlinkedVariableBuilder>[]; 245 List<UnlinkedVariableBuilder> variables = <UnlinkedVariableBuilder>[];
244 for (PropertyAccessorElement accessor in element.accessors) { 246 for (PropertyAccessorElement accessor in element.accessors) {
245 if (accessor.isSynthetic && accessor.isGetter) { 247 if (accessor.isSynthetic && accessor.isGetter) {
246 PropertyInducingElement variable = accessor.variable; 248 PropertyInducingElement variable = accessor.variable;
247 if (variable != null) { 249 if (variable != null) {
248 assert(!variable.isSynthetic); 250 assert(!variable.isSynthetic);
249 variables.add(serializeVariable(variable)); 251 variables.add(serializeVariable(variable));
250 } 252 }
251 } 253 }
252 } 254 }
253 b.variables = variables; 255 b.variables = variables;
254 b.references = unlinkedReferences; 256 b.references = unlinkedReferences;
255 unlinkedUnits.add(b); 257 unlinkedUnits.add(b);
256 prelinkedUnits.add(encodePrelinkedUnit(references: prelinkedReferences)); 258 prelinkedUnits
259 .add(new PrelinkedUnitBuilder(references: prelinkedReferences));
257 unitUris.add(element.source.uri.toString()); 260 unitUris.add(element.source.uri.toString());
258 unlinkedReferences = null; 261 unlinkedReferences = null;
259 prelinkedReferences = null; 262 prelinkedReferences = null;
260 } 263 }
261 264
262 /** 265 /**
263 * Add [exportedLibrary] (and the transitive closure of all libraries it 266 * Add [exportedLibrary] (and the transitive closure of all libraries it
264 * exports) to the dependency table ([PrelinkedLibrary.dependencies]). 267 * exports) to the dependency table ([PrelinkedLibrary.dependencies]).
265 */ 268 */
266 void addTransitiveExportClosure(LibraryElement exportedLibrary) { 269 void addTransitiveExportClosure(LibraryElement exportedLibrary) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 * Return the index of the entry in the dependency table 389 * Return the index of the entry in the dependency table
387 * ([PrelinkedLibrary.dependencies]) for the given [dependentLibrary]. A new 390 * ([PrelinkedLibrary.dependencies]) for the given [dependentLibrary]. A new
388 * entry is added to the table if necessary to satisfy the request. 391 * entry is added to the table if necessary to satisfy the request.
389 */ 392 */
390 int serializeDependency(LibraryElement dependentLibrary) { 393 int serializeDependency(LibraryElement dependentLibrary) {
391 return dependencyMap.putIfAbsent(dependentLibrary, () { 394 return dependencyMap.putIfAbsent(dependentLibrary, () {
392 int index = dependencies.length; 395 int index = dependencies.length;
393 List<String> parts = dependentLibrary.parts 396 List<String> parts = dependentLibrary.parts
394 .map((CompilationUnitElement e) => e.source.uri.toString()) 397 .map((CompilationUnitElement e) => e.source.uri.toString())
395 .toList(); 398 .toList();
396 dependencies.add(encodePrelinkedDependency( 399 dependencies.add(new PrelinkedDependencyBuilder(
397 uri: dependentLibrary.source.uri.toString(), parts: parts)); 400 uri: dependentLibrary.source.uri.toString(), parts: parts));
398 return index; 401 return index;
399 }); 402 });
400 } 403 }
401 404
402 /** 405 /**
403 * Serialize documentation from the given [element], creating an 406 * Serialize documentation from the given [element], creating an
404 * [UnlinkedDocumentationComment]. 407 * [UnlinkedDocumentationComment].
405 * 408 *
406 * If [element] has no documentation, `null` is returned. 409 * If [element] has no documentation, `null` is returned.
407 */ 410 */
408 UnlinkedDocumentationCommentBuilder serializeDocumentation(Element element) { 411 UnlinkedDocumentationCommentBuilder serializeDocumentation(Element element) {
409 if (element.documentationComment == null) { 412 if (element.documentationComment == null) {
410 return null; 413 return null;
411 } 414 }
412 return encodeUnlinkedDocumentationComment( 415 return new UnlinkedDocumentationCommentBuilder(
413 text: element.documentationComment, 416 text: element.documentationComment,
414 offset: element.docRange.offset, 417 offset: element.docRange.offset,
415 length: element.docRange.length); 418 length: element.docRange.length);
416 } 419 }
417 420
418 /** 421 /**
419 * Return the index of the entry in the references table 422 * Return the index of the entry in the references table
420 * ([UnlinkedLibrary.references] and [PrelinkedLibrary.references]) 423 * ([UnlinkedLibrary.references] and [PrelinkedLibrary.references])
421 * representing the pseudo-type `dynamic`. 424 * representing the pseudo-type `dynamic`.
422 */ 425 */
423 int serializeDynamicReference() => 0; 426 int serializeDynamicReference() => 0;
424 427
425 /** 428 /**
426 * Serialize the given [enumElement], creating an [UnlinkedEnum]. 429 * Serialize the given [enumElement], creating an [UnlinkedEnum].
427 */ 430 */
428 UnlinkedEnumBuilder serializeEnum(ClassElement enumElement) { 431 UnlinkedEnumBuilder serializeEnum(ClassElement enumElement) {
429 UnlinkedEnumBuilder b = new UnlinkedEnumBuilder(); 432 UnlinkedEnumBuilder b = new UnlinkedEnumBuilder();
430 b.name = enumElement.name; 433 b.name = enumElement.name;
431 b.nameOffset = enumElement.nameOffset; 434 b.nameOffset = enumElement.nameOffset;
432 List<UnlinkedEnumValueBuilder> values = <UnlinkedEnumValueBuilder>[]; 435 List<UnlinkedEnumValueBuilder> values = <UnlinkedEnumValueBuilder>[];
433 for (FieldElement field in enumElement.fields) { 436 for (FieldElement field in enumElement.fields) {
434 if (field.isConst && field.type.element == enumElement) { 437 if (field.isConst && field.type.element == enumElement) {
435 values.add(encodeUnlinkedEnumValue( 438 values.add(new UnlinkedEnumValueBuilder(
436 name: field.name, 439 name: field.name,
437 nameOffset: field.nameOffset, 440 nameOffset: field.nameOffset,
438 documentationComment: serializeDocumentation(field))); 441 documentationComment: serializeDocumentation(field)));
439 } 442 }
440 } 443 }
441 b.values = values; 444 b.values = values;
442 b.documentationComment = serializeDocumentation(enumElement); 445 b.documentationComment = serializeDocumentation(enumElement);
443 return b; 446 return b;
444 } 447 }
445 448
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 kind = PrelinkedReferenceKind.topLevelPropertyAccessor; 571 kind = PrelinkedReferenceKind.topLevelPropertyAccessor;
569 } else if (element is FunctionTypeAliasElement) { 572 } else if (element is FunctionTypeAliasElement) {
570 kind = PrelinkedReferenceKind.typedef; 573 kind = PrelinkedReferenceKind.typedef;
571 } else if (element is ClassElement) { 574 } else if (element is ClassElement) {
572 kind = PrelinkedReferenceKind.classOrEnum; 575 kind = PrelinkedReferenceKind.classOrEnum;
573 } else if (element is FunctionElement) { 576 } else if (element is FunctionElement) {
574 kind = PrelinkedReferenceKind.topLevelFunction; 577 kind = PrelinkedReferenceKind.topLevelFunction;
575 } else { 578 } else {
576 throw new Exception('Unexpected element kind: ${element.runtimeType}'); 579 throw new Exception('Unexpected element kind: ${element.runtimeType}');
577 } 580 }
578 exportNames.add(encodePrelinkedExportName( 581 exportNames.add(new PrelinkedExportNameBuilder(
579 name: name, 582 name: name,
580 dependency: serializeDependency(dependentLibrary), 583 dependency: serializeDependency(dependentLibrary),
581 unit: unit, 584 unit: unit,
582 kind: kind)); 585 kind: kind));
583 } 586 }
584 pb.exportNames = exportNames; 587 pb.exportNames = exportNames;
585 return pb; 588 return pb;
586 } 589 }
587 590
588 /** 591 /**
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 return b; 625 return b;
623 } 626 }
624 627
625 /** 628 /**
626 * Serialize the given [prefix] into an index into the references table. 629 * Serialize the given [prefix] into an index into the references table.
627 */ 630 */
628 int serializePrefix(PrefixElement element) { 631 int serializePrefix(PrefixElement element) {
629 return referenceMap.putIfAbsent(element, () { 632 return referenceMap.putIfAbsent(element, () {
630 assert(unlinkedReferences.length == prelinkedReferences.length); 633 assert(unlinkedReferences.length == prelinkedReferences.length);
631 int index = unlinkedReferences.length; 634 int index = unlinkedReferences.length;
632 unlinkedReferences.add(encodeUnlinkedReference(name: element.name)); 635 unlinkedReferences.add(new UnlinkedReferenceBuilder(name: element.name));
633 prelinkedReferences 636 prelinkedReferences.add(
634 .add(encodePrelinkedReference(kind: PrelinkedReferenceKind.prefix)); 637 new PrelinkedReferenceBuilder(kind: PrelinkedReferenceKind.prefix));
635 return index; 638 return index;
636 }); 639 });
637 } 640 }
638 641
639 /** 642 /**
640 * Serialize the given [typedefElement], creating an [UnlinkedTypedef]. 643 * Serialize the given [typedefElement], creating an [UnlinkedTypedef].
641 */ 644 */
642 UnlinkedTypedefBuilder serializeTypedef( 645 UnlinkedTypedefBuilder serializeTypedef(
643 FunctionTypeAliasElement typedefElement) { 646 FunctionTypeAliasElement typedefElement) {
644 UnlinkedTypedefBuilder b = new UnlinkedTypedefBuilder(); 647 UnlinkedTypedefBuilder b = new UnlinkedTypedefBuilder();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 // TODO(paulberry): to avoid subtle relinking inconsistencies we 704 // TODO(paulberry): to avoid subtle relinking inconsistencies we
702 // should use the actual prefix from the AST (a given type may be 705 // should use the actual prefix from the AST (a given type may be
703 // reachable via multiple prefixes), but sadly, this information is 706 // reachable via multiple prefixes), but sadly, this information is
704 // not recorded in the element model. 707 // not recorded in the element model.
705 int prefixReference = 0; 708 int prefixReference = 0;
706 PrefixElement prefix = prefixMap[element]; 709 PrefixElement prefix = prefixMap[element];
707 if (prefix != null) { 710 if (prefix != null) {
708 prefixReference = serializePrefix(prefix); 711 prefixReference = serializePrefix(prefix);
709 } 712 }
710 int index = unlinkedReferences.length; 713 int index = unlinkedReferences.length;
711 unlinkedReferences.add(encodeUnlinkedReference( 714 unlinkedReferences.add(new UnlinkedReferenceBuilder(
712 name: element.name, prefixReference: prefixReference)); 715 name: element.name, prefixReference: prefixReference));
713 prelinkedReferences.add(encodePrelinkedReference( 716 prelinkedReferences.add(new PrelinkedReferenceBuilder(
714 dependency: serializeDependency(dependentLibrary), 717 dependency: serializeDependency(dependentLibrary),
715 kind: element is FunctionTypeAliasElement 718 kind: element is FunctionTypeAliasElement
716 ? PrelinkedReferenceKind.typedef 719 ? PrelinkedReferenceKind.typedef
717 : PrelinkedReferenceKind.classOrEnum, 720 : PrelinkedReferenceKind.classOrEnum,
718 unit: unit, 721 unit: unit,
719 numTypeParameters: numTypeParameters)); 722 numTypeParameters: numTypeParameters));
720 return index; 723 return index;
721 }); 724 });
722 } 725 }
723 List<DartType> typeArguments; 726 List<DartType> typeArguments;
(...skipping 19 matching lines...) Expand all
743 * satisfy the request. 746 * satisfy the request.
744 */ 747 */
745 int serializeUnresolvedReference() { 748 int serializeUnresolvedReference() {
746 // TODO(paulberry): in order for relinking to work, we need to record the 749 // TODO(paulberry): in order for relinking to work, we need to record the
747 // name and prefix of the unresolved symbol. This is not (yet) encoded in 750 // name and prefix of the unresolved symbol. This is not (yet) encoded in
748 // the element model. For the moment we use a name that can't possibly 751 // the element model. For the moment we use a name that can't possibly
749 // ever exist. 752 // ever exist.
750 if (unresolvedReferenceIndex == null) { 753 if (unresolvedReferenceIndex == null) {
751 assert(unlinkedReferences.length == prelinkedReferences.length); 754 assert(unlinkedReferences.length == prelinkedReferences.length);
752 unresolvedReferenceIndex = unlinkedReferences.length; 755 unresolvedReferenceIndex = unlinkedReferences.length;
753 unlinkedReferences.add(encodeUnlinkedReference(name: '*unresolved*')); 756 unlinkedReferences
754 prelinkedReferences.add( 757 .add(new UnlinkedReferenceBuilder(name: '*unresolved*'));
755 encodePrelinkedReference(kind: PrelinkedReferenceKind.unresolved)); 758 prelinkedReferences.add(new PrelinkedReferenceBuilder(
759 kind: PrelinkedReferenceKind.unresolved));
756 } 760 }
757 return unresolvedReferenceIndex; 761 return unresolvedReferenceIndex;
758 } 762 }
759 763
760 /** 764 /**
761 * Serialize the given [variable], creating an [UnlinkedVariable]. 765 * Serialize the given [variable], creating an [UnlinkedVariable].
762 */ 766 */
763 UnlinkedVariableBuilder serializeVariable(PropertyInducingElement variable) { 767 UnlinkedVariableBuilder serializeVariable(PropertyInducingElement variable) {
764 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(); 768 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder();
765 b.name = variable.name; 769 b.name = variable.name;
766 b.nameOffset = variable.nameOffset; 770 b.nameOffset = variable.nameOffset;
767 b.type = serializeTypeRef(variable.type, variable); 771 b.type = serializeTypeRef(variable.type, variable);
768 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; 772 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement;
769 b.isFinal = variable.isFinal; 773 b.isFinal = variable.isFinal;
770 b.isConst = variable.isConst; 774 b.isConst = variable.isConst;
771 b.hasImplicitType = variable.hasImplicitType; 775 b.hasImplicitType = variable.hasImplicitType;
772 b.documentationComment = serializeDocumentation(variable); 776 b.documentationComment = serializeDocumentation(variable);
773 return b; 777 return b;
774 } 778 }
775 } 779 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/public_namespace_computer.dart ('k') | pkg/analyzer/test/src/summary/name_filter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698