| 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 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 if (cls.isMixinApplication) { | 602 if (cls.isMixinApplication) { |
| 603 // Mixin application members can't be determined directly from the AST so | 603 // Mixin application members can't be determined directly from the AST so |
| 604 // we can't store them in UnlinkedPublicName. | 604 // we can't store them in UnlinkedPublicName. |
| 605 // TODO(paulberry): find somewhere else to store them. | 605 // TODO(paulberry): find somewhere else to store them. |
| 606 return null; | 606 return null; |
| 607 } | 607 } |
| 608 if (cls.kind == ElementKind.CLASS) { | 608 if (cls.kind == ElementKind.CLASS) { |
| 609 List<UnlinkedPublicNameBuilder> bs = <UnlinkedPublicNameBuilder>[]; | 609 List<UnlinkedPublicNameBuilder> bs = <UnlinkedPublicNameBuilder>[]; |
| 610 for (FieldElement field in cls.fields) { | 610 for (FieldElement field in cls.fields) { |
| 611 if (field.isStatic && field.isConst && field.isPublic) { | 611 if (field.isStatic && field.isConst && field.isPublic) { |
| 612 // TODO(paulberry): include non-consts |
| 612 // TODO(paulberry): should numTypeParameters include class params? | 613 // TODO(paulberry): should numTypeParameters include class params? |
| 613 bs.add(new UnlinkedPublicNameBuilder( | 614 bs.add(new UnlinkedPublicNameBuilder( |
| 614 name: field.name, | 615 name: field.name, |
| 615 kind: ReferenceKind.propertyAccessor, | 616 kind: ReferenceKind.propertyAccessor, |
| 616 numTypeParameters: 0)); | 617 numTypeParameters: 0)); |
| 617 } | 618 } |
| 618 } | 619 } |
| 619 for (MethodElement method in cls.methods) { | 620 for (MethodElement method in cls.methods) { |
| 620 if (method.isStatic && method.isPublic) { | 621 if (method.isStatic && method.isPublic) { |
| 621 // TODO(paulberry): should numTypeParameters include class params? | 622 // TODO(paulberry): should numTypeParameters include class params? |
| 622 bs.add(new UnlinkedPublicNameBuilder( | 623 bs.add(new UnlinkedPublicNameBuilder( |
| 623 name: method.name, | 624 name: method.name, |
| 624 kind: ReferenceKind.method, | 625 kind: ReferenceKind.method, |
| 625 numTypeParameters: method.typeParameters.length)); | 626 numTypeParameters: method.typeParameters.length)); |
| 626 } | 627 } |
| 627 } | 628 } |
| 629 for (PropertyAccessorElement accessor in cls.accessors) { |
| 630 if (accessor.isStatic && |
| 631 accessor.isGetter && |
| 632 accessor.isPublic && |
| 633 !accessor.isSynthetic) { |
| 634 // TODO(paulberry): combine with field code above. |
| 635 // TODO(paulberry): should numTypeParameters include class params? |
| 636 bs.add(new UnlinkedPublicNameBuilder( |
| 637 name: accessor.name, kind: ReferenceKind.propertyAccessor)); |
| 638 } |
| 639 } |
| 628 for (ConstructorElement constructor in cls.constructors) { | 640 for (ConstructorElement constructor in cls.constructors) { |
| 629 if (constructor.isPublic && constructor.name.isNotEmpty) { | 641 if (constructor.isPublic && constructor.name.isNotEmpty) { |
| 630 // TODO(paulberry): should numTypeParameters include class params? | 642 // TODO(paulberry): should numTypeParameters include class params? |
| 631 bs.add(new UnlinkedPublicNameBuilder( | 643 bs.add(new UnlinkedPublicNameBuilder( |
| 632 name: constructor.name, | 644 name: constructor.name, |
| 633 kind: ReferenceKind.constructor, | 645 kind: ReferenceKind.constructor, |
| 634 numTypeParameters: 0)); | 646 numTypeParameters: 0)); |
| 635 } | 647 } |
| 636 } | 648 } |
| 637 return bs; | 649 return bs; |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1668 exportNames.add(new LinkedExportNameBuilder( | 1680 exportNames.add(new LinkedExportNameBuilder( |
| 1669 name: name, | 1681 name: name, |
| 1670 dependency: serializeDependency(dependentLibrary), | 1682 dependency: serializeDependency(dependentLibrary), |
| 1671 unit: unit, | 1683 unit: unit, |
| 1672 kind: kind)); | 1684 kind: kind)); |
| 1673 } | 1685 } |
| 1674 pb.exportNames = exportNames; | 1686 pb.exportNames = exportNames; |
| 1675 return pb; | 1687 return pb; |
| 1676 } | 1688 } |
| 1677 } | 1689 } |
| OLD | NEW |