| 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/element.dart'; | 9 import 'package:analyzer/src/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/dart/element/member.dart'; | 10 import 'package:analyzer/src/dart/element/member.dart'; |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 b.type = serializeTypeRef(type, context); | 691 b.type = serializeTypeRef(type, context); |
| 692 } | 692 } |
| 693 } | 693 } |
| 694 if (parameter is ConstVariableElement) { | 694 if (parameter is ConstVariableElement) { |
| 695 ConstVariableElement constParameter = parameter as ConstVariableElement; | 695 ConstVariableElement constParameter = parameter as ConstVariableElement; |
| 696 Expression initializer = constParameter.constantInitializer; | 696 Expression initializer = constParameter.constantInitializer; |
| 697 if (initializer != null) { | 697 if (initializer != null) { |
| 698 b.defaultValue = serializeConstExpr(initializer); | 698 b.defaultValue = serializeConstExpr(initializer); |
| 699 } | 699 } |
| 700 } | 700 } |
| 701 { |
| 702 SourceRange visibleRange = parameter.visibleRange; |
| 703 if (visibleRange != null) { |
| 704 b.visibleOffset = visibleRange.offset; |
| 705 b.visibleLength = visibleRange.length; |
| 706 } |
| 707 } |
| 701 return b; | 708 return b; |
| 702 } | 709 } |
| 703 | 710 |
| 704 /** | 711 /** |
| 705 * Serialize the given [prefix] into an index into the references table. | 712 * Serialize the given [prefix] into an index into the references table. |
| 706 */ | 713 */ |
| 707 int serializePrefix(PrefixElement element) { | 714 int serializePrefix(PrefixElement element) { |
| 708 return referenceMap.putIfAbsent(element, | 715 return referenceMap.putIfAbsent(element, |
| 709 () => serializeUnlinkedReference(element.name, ReferenceKind.prefix)); | 716 () => serializeUnlinkedReference(element.name, ReferenceKind.prefix)); |
| 710 } | 717 } |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 exportNames.add(new LinkedExportNameBuilder( | 1310 exportNames.add(new LinkedExportNameBuilder( |
| 1304 name: name, | 1311 name: name, |
| 1305 dependency: serializeDependency(dependentLibrary), | 1312 dependency: serializeDependency(dependentLibrary), |
| 1306 unit: unit, | 1313 unit: unit, |
| 1307 kind: kind)); | 1314 kind: kind)); |
| 1308 } | 1315 } |
| 1309 pb.exportNames = exportNames; | 1316 pb.exportNames = exportNames; |
| 1310 return pb; | 1317 return pb; |
| 1311 } | 1318 } |
| 1312 } | 1319 } |
| OLD | NEW |