OLD | NEW |
---|---|
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:io'; | 5 import 'dart:io'; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
687 } | 687 } |
688 | 688 |
689 void writePropertyInducingElement(PropertyInducingElement e) { | 689 void writePropertyInducingElement(PropertyInducingElement e) { |
690 if (e.isSynthetic && !withSyntheticFields && !isEnumField(e)) { | 690 if (e.isSynthetic && !withSyntheticFields && !isEnumField(e)) { |
691 return; | 691 return; |
692 } | 692 } |
693 | 693 |
694 DartType type = e.type; | 694 DartType type = e.type; |
695 expect(type, isNotNull); | 695 expect(type, isNotNull); |
696 | 696 |
697 if (!e.isSynthetic) { | |
698 expect(e.getter, isNotNull); | |
699 expect(e.getter.isSynthetic, isTrue); | |
700 expect(e.getter.variable, same(e)); | |
701 if (!e.isFinal && !e.isConst) { | |
702 expect(e.setter, isNotNull); | |
703 expect(e.setter.isSynthetic, isTrue); | |
704 expect(e.setter.variable, same(e.getter.variable)); | |
705 } | |
Paul Berry
2017/07/15 15:33:17
Consider adding:
else {
expect(e.setter, isNull
| |
706 } | |
707 | |
697 if (e.enclosingElement is ClassElement) { | 708 if (e.enclosingElement is ClassElement) { |
698 writeDocumentation(e, ' '); | 709 writeDocumentation(e, ' '); |
699 writeMetadata(e, ' ', '\n'); | 710 writeMetadata(e, ' ', '\n'); |
700 | 711 |
701 buffer.write(' '); | 712 buffer.write(' '); |
702 | 713 |
703 writeIf(e.isSynthetic, 'synthetic '); | 714 writeIf(e.isSynthetic, 'synthetic '); |
704 writeIf(e.isStatic, 'static '); | 715 writeIf(e.isStatic, 'static '); |
705 writeIf(e is FieldElementImpl && e.isCovariant, 'covariant '); | 716 writeIf(e is FieldElementImpl && e.isCovariant, 'covariant '); |
706 } else { | 717 } else { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
823 return components.join(';'); | 834 return components.join(';'); |
824 } | 835 } |
825 } | 836 } |
826 | 837 |
827 class _Replacement { | 838 class _Replacement { |
828 final int offset; | 839 final int offset; |
829 final int end; | 840 final int end; |
830 final String text; | 841 final String text; |
831 _Replacement(this.offset, this.end, this.text); | 842 _Replacement(this.offset, this.end, this.text); |
832 } | 843 } |
OLD | NEW |