| 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 test.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
| 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/type.dart'; | 10 import 'package:analyzer/src/dart/element/type.dart'; |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 analysisContext.sourceFactory, | 574 analysisContext.sourceFactory, |
| 575 unlinkedSummaries, | 575 unlinkedSummaries, |
| 576 linkedSummaries); | 576 linkedSummaries); |
| 577 LibraryElementImpl resynthesized = resynthesizer.getLibraryElement(uri); | 577 LibraryElementImpl resynthesized = resynthesizer.getLibraryElement(uri); |
| 578 // Check that no other summaries needed to be resynthesized to resynthesize | 578 // Check that no other summaries needed to be resynthesized to resynthesize |
| 579 // the library element. | 579 // the library element. |
| 580 expect(resynthesizer.resynthesisCount, 1); | 580 expect(resynthesizer.resynthesisCount, 1); |
| 581 return resynthesized; | 581 return resynthesized; |
| 582 } | 582 } |
| 583 | 583 |
| 584 test_class_abstract() { |
| 585 checkLibrary('abstract class C {}'); |
| 586 } |
| 587 |
| 584 test_class_alias() { | 588 test_class_alias() { |
| 585 checkLibrary('class C = D with E, F; class D {} class E {} class F {}'); | 589 checkLibrary('class C = D with E, F; class D {} class E {} class F {}'); |
| 586 } | 590 } |
| 587 | 591 |
| 592 test_class_alias_abstract() { |
| 593 checkLibrary('abstract class C = D with E; class D {} class E {}'); |
| 594 } |
| 595 |
| 588 test_class_alias_documented() { | 596 test_class_alias_documented() { |
| 589 checkLibrary(''' | 597 checkLibrary(''' |
| 590 // Extra comment so doc comment offset != 0 | 598 // Extra comment so doc comment offset != 0 |
| 591 /** | 599 /** |
| 592 * Docs | 600 * Docs |
| 593 */ | 601 */ |
| 594 class C = D with E; | 602 class C = D with E; |
| 595 | 603 |
| 596 class D {} | 604 class D {} |
| 597 class E {}'''); | 605 class E {}'''); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 } | 782 } |
| 775 | 783 |
| 776 test_class_field_static() { | 784 test_class_field_static() { |
| 777 checkLibrary('class C { static int i; }'); | 785 checkLibrary('class C { static int i; }'); |
| 778 } | 786 } |
| 779 | 787 |
| 780 test_class_fields() { | 788 test_class_fields() { |
| 781 checkLibrary('class C { int i; int j; }'); | 789 checkLibrary('class C { int i; int j; }'); |
| 782 } | 790 } |
| 783 | 791 |
| 792 test_class_getter_abstract() { |
| 793 checkLibrary('abstract class C { int get x; }'); |
| 794 } |
| 795 |
| 784 test_class_getter_external() { | 796 test_class_getter_external() { |
| 785 checkLibrary('class C { external int get x; }'); | 797 checkLibrary('class C { external int get x; }'); |
| 786 } | 798 } |
| 787 | 799 |
| 788 test_class_getter_implicit_return_type() { | 800 test_class_getter_implicit_return_type() { |
| 789 checkLibrary('class C { get x => null; }'); | 801 checkLibrary('class C { get x => null; }'); |
| 790 } | 802 } |
| 791 | 803 |
| 792 test_class_getter_static() { | 804 test_class_getter_static() { |
| 793 checkLibrary('class C { static int get x => null; }'); | 805 checkLibrary('class C { static int get x => null; }'); |
| 794 } | 806 } |
| 795 | 807 |
| 796 test_class_getters() { | 808 test_class_getters() { |
| 797 checkLibrary('class C { int get x => null; get y => null; }'); | 809 checkLibrary('class C { int get x => null; get y => null; }'); |
| 798 } | 810 } |
| 799 | 811 |
| 800 test_class_implicitField_getterFirst() { | 812 test_class_implicitField_getterFirst() { |
| 801 checkLibrary('class C { int get x => 0; void set x(int value) {} }'); | 813 checkLibrary('class C { int get x => 0; void set x(int value) {} }'); |
| 802 } | 814 } |
| 803 | 815 |
| 804 test_class_implicitField_setterFirst() { | 816 test_class_implicitField_setterFirst() { |
| 805 checkLibrary('class C { void set x(int value) {} int get x => 0; }'); | 817 checkLibrary('class C { void set x(int value) {} int get x => 0; }'); |
| 806 } | 818 } |
| 807 | 819 |
| 808 test_class_interfaces() { | 820 test_class_interfaces() { |
| 809 checkLibrary('class C implements D, E {} class D {} class E {}'); | 821 checkLibrary('class C implements D, E {} class D {} class E {}'); |
| 810 } | 822 } |
| 811 | 823 |
| 824 test_class_method_abstract() { |
| 825 checkLibrary('abstract class C { f(); }'); |
| 826 } |
| 827 |
| 812 test_class_method_external() { | 828 test_class_method_external() { |
| 813 checkLibrary('class C { external f(); }'); | 829 checkLibrary('class C { external f(); }'); |
| 814 } | 830 } |
| 815 | 831 |
| 816 test_class_method_params() { | 832 test_class_method_params() { |
| 817 checkLibrary('class C { f(x, y) {} }'); | 833 checkLibrary('class C { f(x, y) {} }'); |
| 818 } | 834 } |
| 819 | 835 |
| 820 test_class_method_static() { | 836 test_class_method_static() { |
| 821 checkLibrary('class C { static f() {} }'); | 837 checkLibrary('class C { static f() {} }'); |
| 822 } | 838 } |
| 823 | 839 |
| 824 test_class_methods() { | 840 test_class_methods() { |
| 825 checkLibrary('class C { f() {} g() {} }'); | 841 checkLibrary('class C { f() {} g() {} }'); |
| 826 } | 842 } |
| 827 | 843 |
| 828 test_class_mixins() { | 844 test_class_mixins() { |
| 829 checkLibrary('class C extends Object with D, E {} class D {} class E {}'); | 845 checkLibrary('class C extends Object with D, E {} class D {} class E {}'); |
| 830 } | 846 } |
| 831 | 847 |
| 848 test_class_setter_abstract() { |
| 849 checkLibrary('abstract class C { void set x(int value); }'); |
| 850 } |
| 851 |
| 832 test_class_setter_external() { | 852 test_class_setter_external() { |
| 833 checkLibrary('class C { external void set x(int value); }'); | 853 checkLibrary('class C { external void set x(int value); }'); |
| 834 } | 854 } |
| 835 | 855 |
| 836 test_class_setter_implicit_param_type() { | 856 test_class_setter_implicit_param_type() { |
| 837 checkLibrary('class C { void set x(value) {} }'); | 857 checkLibrary('class C { void set x(value) {} }'); |
| 838 } | 858 } |
| 839 | 859 |
| 840 test_class_setter_implicit_return_type() { | 860 test_class_setter_implicit_return_type() { |
| 841 if (analysisContext.analysisOptions.strongMode) { | 861 if (analysisContext.analysisOptions.strongMode) { |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 fail('Unexpectedly tried to get unlinked summary for $uri'); | 1731 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 1712 } | 1732 } |
| 1713 return serializedUnit; | 1733 return serializedUnit; |
| 1714 } | 1734 } |
| 1715 | 1735 |
| 1716 @override | 1736 @override |
| 1717 bool hasLibrarySummary(String uri) { | 1737 bool hasLibrarySummary(String uri) { |
| 1718 return true; | 1738 return true; |
| 1719 } | 1739 } |
| 1720 } | 1740 } |
| OLD | NEW |