| OLD | NEW |
| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 } | 383 } |
| 384 | 384 |
| 385 /** | 385 /** |
| 386 * Return the index of the entry in the dependency table | 386 * Return the index of the entry in the dependency table |
| 387 * ([PrelinkedLibrary.dependencies]) for the given [dependentLibrary]. A new | 387 * ([PrelinkedLibrary.dependencies]) for the given [dependentLibrary]. A new |
| 388 * entry is added to the table if necessary to satisfy the request. | 388 * entry is added to the table if necessary to satisfy the request. |
| 389 */ | 389 */ |
| 390 int serializeDependency(LibraryElement dependentLibrary) { | 390 int serializeDependency(LibraryElement dependentLibrary) { |
| 391 return dependencyMap.putIfAbsent(dependentLibrary, () { | 391 return dependencyMap.putIfAbsent(dependentLibrary, () { |
| 392 int index = dependencies.length; | 392 int index = dependencies.length; |
| 393 List<String> parts = dependentLibrary.parts |
| 394 .map((CompilationUnitElement e) => e.source.uri.toString()) |
| 395 .toList(); |
| 393 dependencies.add(encodePrelinkedDependency( | 396 dependencies.add(encodePrelinkedDependency( |
| 394 uri: dependentLibrary.source.uri.toString())); | 397 uri: dependentLibrary.source.uri.toString(), parts: parts)); |
| 395 return index; | 398 return index; |
| 396 }); | 399 }); |
| 397 } | 400 } |
| 398 | 401 |
| 399 /** | 402 /** |
| 400 * Serialize documentation from the given [element], creating an | 403 * Serialize documentation from the given [element], creating an |
| 401 * [UnlinkedDocumentationComment]. | 404 * [UnlinkedDocumentationComment]. |
| 402 * | 405 * |
| 403 * If [element] has no documentation, `null` is returned. | 406 * If [element] has no documentation, `null` is returned. |
| 404 */ | 407 */ |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 b.nameOffset = variable.nameOffset; | 731 b.nameOffset = variable.nameOffset; |
| 729 b.type = serializeTypeRef(variable.type, variable); | 732 b.type = serializeTypeRef(variable.type, variable); |
| 730 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; | 733 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; |
| 731 b.isFinal = variable.isFinal; | 734 b.isFinal = variable.isFinal; |
| 732 b.isConst = variable.isConst; | 735 b.isConst = variable.isConst; |
| 733 b.hasImplicitType = variable.hasImplicitType; | 736 b.hasImplicitType = variable.hasImplicitType; |
| 734 b.documentationComment = serializeDocumentation(variable); | 737 b.documentationComment = serializeDocumentation(variable); |
| 735 return b; | 738 return b; |
| 736 } | 739 } |
| 737 } | 740 } |
| OLD | NEW |