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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 buffer.write('part '); | 639 buffer.write('part '); |
640 writeUri(e, e.source); | 640 writeUri(e, e.source); |
641 buffer.writeln(';'); | 641 buffer.writeln(';'); |
642 } | 642 } |
643 | 643 |
644 void writePropertyAccessorElement(PropertyAccessorElement e) { | 644 void writePropertyAccessorElement(PropertyAccessorElement e) { |
645 if (e.isSynthetic && !withSyntheticAccessors) { | 645 if (e.isSynthetic && !withSyntheticAccessors) { |
646 return; | 646 return; |
647 } | 647 } |
648 | 648 |
| 649 if (!e.isSynthetic) { |
| 650 PropertyInducingElement variable = e.variable; |
| 651 expect(variable, isNotNull); |
| 652 if (e.isGetter) { |
| 653 expect(variable.getter, same(e)); |
| 654 if (variable.setter != null) { |
| 655 expect(variable.setter.variable, same(variable)); |
| 656 } |
| 657 } else { |
| 658 expect(variable.setter, same(e)); |
| 659 if (variable.getter != null) { |
| 660 expect(variable.getter.variable, same(variable)); |
| 661 } |
| 662 } |
| 663 } |
| 664 |
649 if (e.enclosingElement is ClassElement) { | 665 if (e.enclosingElement is ClassElement) { |
650 writeDocumentation(e, ' '); | 666 writeDocumentation(e, ' '); |
651 writeMetadata(e, ' ', '\n'); | 667 writeMetadata(e, ' ', '\n'); |
652 | 668 |
653 buffer.write(' '); | 669 buffer.write(' '); |
654 | 670 |
655 writeIf(e.isSynthetic, 'synthetic '); | 671 writeIf(e.isSynthetic, 'synthetic '); |
656 writeIf(e.isStatic, 'static '); | 672 writeIf(e.isStatic, 'static '); |
657 } else { | 673 } else { |
658 writeDocumentation(e); | 674 writeDocumentation(e); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 return components.join(';'); | 855 return components.join(';'); |
840 } | 856 } |
841 } | 857 } |
842 | 858 |
843 class _Replacement { | 859 class _Replacement { |
844 final int offset; | 860 final int offset; |
845 final int end; | 861 final int end; |
846 final String text; | 862 final String text; |
847 _Replacement(this.offset, this.end, this.text); | 863 _Replacement(this.offset, this.end, this.text); |
848 } | 864 } |
OLD | NEW |