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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 if (executableElement.isFactory) { | 546 if (executableElement.isFactory) { |
547 InterfaceType returnType = redirectedConstructor is ConstructorMember | 547 InterfaceType returnType = redirectedConstructor is ConstructorMember |
548 ? redirectedConstructor.definingType | 548 ? redirectedConstructor.definingType |
549 : redirectedConstructor.enclosingElement.type; | 549 : redirectedConstructor.enclosingElement.type; |
550 EntityRefBuilder typeRef = | 550 EntityRefBuilder typeRef = |
551 serializeTypeRef(returnType, executableElement); | 551 serializeTypeRef(returnType, executableElement); |
552 if (redirectedConstructor.name.isNotEmpty) { | 552 if (redirectedConstructor.name.isNotEmpty) { |
553 String name = redirectedConstructor.name; | 553 String name = redirectedConstructor.name; |
554 int typeId = typeRef.reference; | 554 int typeId = typeRef.reference; |
555 LinkedReference typeLinkedRef = linkedReferences[typeId]; | 555 LinkedReference typeLinkedRef = linkedReferences[typeId]; |
556 unlinkedReferences.add(new UnlinkedReferenceBuilder( | 556 int refId = serializeUnlinkedReference( |
557 name: name, prefixReference: typeId)); | 557 name, ReferenceKind.constructor, |
558 int refId = linkedReferences.length; | 558 unit: typeLinkedRef.unit, prefixReference: typeId); |
559 linkedReferences.add(new LinkedReferenceBuilder( | |
560 kind: ReferenceKind.constructor, unit: typeLinkedRef.unit)); | |
561 b.redirectedConstructor = new EntityRefBuilder( | 559 b.redirectedConstructor = new EntityRefBuilder( |
562 reference: refId, typeArguments: typeRef.typeArguments); | 560 reference: refId, typeArguments: typeRef.typeArguments); |
563 } else { | 561 } else { |
564 b.redirectedConstructor = typeRef; | 562 b.redirectedConstructor = typeRef; |
565 } | 563 } |
566 } else { | 564 } else { |
567 b.redirectedConstructorName = redirectedConstructor.name; | 565 b.redirectedConstructorName = redirectedConstructor.name; |
568 } | 566 } |
569 } | 567 } |
570 if (executableElement.isConst && | 568 if (executableElement.isConst && |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 exportNames.add(new LinkedExportNameBuilder( | 1281 exportNames.add(new LinkedExportNameBuilder( |
1284 name: name, | 1282 name: name, |
1285 dependency: serializeDependency(dependentLibrary), | 1283 dependency: serializeDependency(dependentLibrary), |
1286 unit: unit, | 1284 unit: unit, |
1287 kind: kind)); | 1285 kind: kind)); |
1288 } | 1286 } |
1289 pb.exportNames = exportNames; | 1287 pb.exportNames = exportNames; |
1290 return pb; | 1288 return pb; |
1291 } | 1289 } |
1292 } | 1290 } |
OLD | NEW |