Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1020)

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_common.dart

Issue 2981303002: Include default values for default field formal parameters into text dump. (Closed)
Patch Set: Remove debug output. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/test/src/summary/element_text.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 '''); 1980 ''');
1981 } 1981 }
1982 } 1982 }
1983 1983
1984 test_class_constructor_fieldFormal_named_withDefault() async { 1984 test_class_constructor_fieldFormal_named_withDefault() async {
1985 var library = await checkLibrary('class C { int x; C({this.x: 42}); }'); 1985 var library = await checkLibrary('class C { int x; C({this.x: 42}); }');
1986 if (isStrongMode) { 1986 if (isStrongMode) {
1987 checkElementText(library, r''' 1987 checkElementText(library, r'''
1988 class C { 1988 class C {
1989 int x; 1989 int x;
1990 C({int this.x}); 1990 C({int this.x: 42});
1991 } 1991 }
1992 '''); 1992 ''');
1993 } else { 1993 } else {
1994 checkElementText(library, r''' 1994 checkElementText(library, r'''
1995 class C { 1995 class C {
1996 int x; 1996 int x;
1997 C({int this.x}); 1997 C({int this.x: 42});
1998 } 1998 }
1999 '''); 1999 ''');
2000 } 2000 }
2001 } 2001 }
2002 2002
2003 test_class_constructor_fieldFormal_optional_noDefault() async { 2003 test_class_constructor_fieldFormal_optional_noDefault() async {
2004 var library = await checkLibrary('class C { int x; C([this.x]); }'); 2004 var library = await checkLibrary('class C { int x; C([this.x]); }');
2005 if (isStrongMode) { 2005 if (isStrongMode) {
2006 checkElementText(library, r''' 2006 checkElementText(library, r'''
2007 class C { 2007 class C {
(...skipping 10 matching lines...) Expand all
2018 '''); 2018 ''');
2019 } 2019 }
2020 } 2020 }
2021 2021
2022 test_class_constructor_fieldFormal_optional_withDefault() async { 2022 test_class_constructor_fieldFormal_optional_withDefault() async {
2023 var library = await checkLibrary('class C { int x; C([this.x = 42]); }'); 2023 var library = await checkLibrary('class C { int x; C([this.x = 42]); }');
2024 if (isStrongMode) { 2024 if (isStrongMode) {
2025 checkElementText(library, r''' 2025 checkElementText(library, r'''
2026 class C { 2026 class C {
2027 int x; 2027 int x;
2028 C([int this.x]); 2028 C([int this.x = 42]);
2029 } 2029 }
2030 '''); 2030 ''');
2031 } else { 2031 } else {
2032 checkElementText(library, r''' 2032 checkElementText(library, r'''
2033 class C { 2033 class C {
2034 int x; 2034 int x;
2035 C([int this.x]); 2035 C([int this.x = 42]);
2036 } 2036 }
2037 '''); 2037 ''');
2038 } 2038 }
2039 } 2039 }
2040 2040
2041 test_class_constructor_implicit() async { 2041 test_class_constructor_implicit() async {
2042 var library = await checkLibrary('class C {}'); 2042 var library = await checkLibrary('class C {}');
2043 if (isStrongMode) { 2043 if (isStrongMode) {
2044 checkElementText(library, r''' 2044 checkElementText(library, r'''
2045 class C { 2045 class C {
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
3814 class C { 3814 class C {
3815 final x; 3815 final x;
3816 const C({this.x: foo}); 3816 const C({this.x: foo});
3817 } 3817 }
3818 int foo() => 42; 3818 int foo() => 42;
3819 '''); 3819 ''');
3820 if (isStrongMode) { 3820 if (isStrongMode) {
3821 checkElementText(library, r''' 3821 checkElementText(library, r'''
3822 class C { 3822 class C {
3823 final dynamic x; 3823 final dynamic x;
3824 const C({dynamic this.x}); 3824 const C({dynamic this.x:
3825 foo/*location: test.dart;foo*/});
3825 } 3826 }
3826 int foo() {} 3827 int foo() {}
3827 '''); 3828 ''');
3828 } else { 3829 } else {
3829 checkElementText(library, r''' 3830 checkElementText(library, r'''
3830 class C { 3831 class C {
3831 final dynamic x; 3832 final dynamic x;
3832 const C({dynamic this.x}); 3833 const C({dynamic this.x:
3834 foo/*location: test.dart;foo*/});
3833 } 3835 }
3834 int foo() {} 3836 int foo() {}
3835 '''); 3837 ''');
3836 } 3838 }
3837 } 3839 }
3838 3840
3839 test_const_parameterDefaultValue_initializingFormal_named() async { 3841 test_const_parameterDefaultValue_initializingFormal_named() async {
3840 var library = await checkLibrary(r''' 3842 var library = await checkLibrary(r'''
3841 class C { 3843 class C {
3842 final x; 3844 final x;
3843 const C({this.x: 1 + 2}); 3845 const C({this.x: 1 + 2});
3844 } 3846 }
3845 '''); 3847 ''');
3846 if (isStrongMode) { 3848 if (isStrongMode) {
3847 checkElementText(library, r''' 3849 checkElementText(library, r'''
3848 class C { 3850 class C {
3849 final dynamic x; 3851 final dynamic x;
3850 const C({dynamic this.x}); 3852 const C({dynamic this.x: 1 + 2});
3851 } 3853 }
3852 '''); 3854 ''');
3853 } else { 3855 } else {
3854 checkElementText(library, r''' 3856 checkElementText(library, r'''
3855 class C { 3857 class C {
3856 final dynamic x; 3858 final dynamic x;
3857 const C({dynamic this.x}); 3859 const C({dynamic this.x: 1 + 2});
3858 } 3860 }
3859 '''); 3861 ''');
3860 } 3862 }
3861 } 3863 }
3862 3864
3863 test_const_parameterDefaultValue_initializingFormal_positional() async { 3865 test_const_parameterDefaultValue_initializingFormal_positional() async {
3864 var library = await checkLibrary(r''' 3866 var library = await checkLibrary(r'''
3865 class C { 3867 class C {
3866 final x; 3868 final x;
3867 const C([this.x = 1 + 2]); 3869 const C([this.x = 1 + 2]);
3868 } 3870 }
3869 '''); 3871 ''');
3870 if (isStrongMode) { 3872 if (isStrongMode) {
3871 checkElementText(library, r''' 3873 checkElementText(library, r'''
3872 class C { 3874 class C {
3873 final dynamic x; 3875 final dynamic x;
3874 const C([dynamic this.x]); 3876 const C([dynamic this.x = 1 + 2]);
3875 } 3877 }
3876 '''); 3878 ''');
3877 } else { 3879 } else {
3878 checkElementText(library, r''' 3880 checkElementText(library, r'''
3879 class C { 3881 class C {
3880 final dynamic x; 3882 final dynamic x;
3881 const C([dynamic this.x]); 3883 const C([dynamic this.x = 1 + 2]);
3882 } 3884 }
3883 '''); 3885 ''');
3884 } 3886 }
3885 } 3887 }
3886 3888
3887 test_const_parameterDefaultValue_normal() async { 3889 test_const_parameterDefaultValue_normal() async {
3888 var library = await checkLibrary(r''' 3890 var library = await checkLibrary(r'''
3889 class C { 3891 class C {
3890 const C.positional([p = 1 + 2]); 3892 const C.positional([p = 1 + 2]);
3891 const C.named({p: 1 + 2}); 3893 const C.named({p: 1 + 2});
(...skipping 5879 matching lines...) Expand 10 before | Expand all | Expand 10 after
9771 } 9773 }
9772 9774
9773 test_metadata_fieldFormalParameter_withDefault() async { 9775 test_metadata_fieldFormalParameter_withDefault() async {
9774 var library = await checkLibrary( 9776 var library = await checkLibrary(
9775 'const a = null; class C { var x; C([@a this.x = null]); }'); 9777 'const a = null; class C { var x; C([@a this.x = null]); }');
9776 if (isStrongMode) { 9778 if (isStrongMode) {
9777 checkElementText(library, r''' 9779 checkElementText(library, r'''
9778 class C { 9780 class C {
9779 dynamic x; 9781 dynamic x;
9780 C([@ 9782 C([@
9781 a/*location: test.dart;a?*/ dynamic this.x]); 9783 a/*location: test.dart;a?*/ dynamic this.x = null]);
9782 } 9784 }
9783 const dynamic a = null; 9785 const dynamic a = null;
9784 '''); 9786 ''');
9785 } else { 9787 } else {
9786 checkElementText(library, r''' 9788 checkElementText(library, r'''
9787 class C { 9789 class C {
9788 dynamic x; 9790 dynamic x;
9789 C([@ 9791 C([@
9790 a/*location: test.dart;a?*/ dynamic this.x]); 9792 a/*location: test.dart;a?*/ dynamic this.x = null]);
9791 } 9793 }
9792 const dynamic a = null; 9794 const dynamic a = null;
9793 '''); 9795 ''');
9794 } 9796 }
9795 } 9797 }
9796 9798
9797 test_metadata_functionDeclaration_function() async { 9799 test_metadata_functionDeclaration_function() async {
9798 var library = await checkLibrary(''' 9800 var library = await checkLibrary('''
9799 const a = null; 9801 const a = null;
9800 @a 9802 @a
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
10944 class C { 10946 class C {
10945 var x; 10947 var x;
10946 C.positional([this.x = 1]); 10948 C.positional([this.x = 1]);
10947 C.named({this.x: 1}); 10949 C.named({this.x: 1});
10948 } 10950 }
10949 '''); 10951 ''');
10950 if (isStrongMode) { 10952 if (isStrongMode) {
10951 checkElementText(library, r''' 10953 checkElementText(library, r'''
10952 class C { 10954 class C {
10953 dynamic x; 10955 dynamic x;
10954 C.positional([dynamic this.x]); 10956 C.positional([dynamic this.x = 1]);
10955 C.named({dynamic this.x}); 10957 C.named({dynamic this.x: 1});
10956 } 10958 }
10957 '''); 10959 ''');
10958 } else { 10960 } else {
10959 checkElementText(library, r''' 10961 checkElementText(library, r'''
10960 class C { 10962 class C {
10961 dynamic x; 10963 dynamic x;
10962 C.positional([dynamic this.x]); 10964 C.positional([dynamic this.x = 1]);
10963 C.named({dynamic this.x}); 10965 C.named({dynamic this.x: 1});
10964 } 10966 }
10965 '''); 10967 ''');
10966 } 10968 }
10967 } 10969 }
10968 10970
10969 test_parameterTypeNotInferred_staticMethod() async { 10971 test_parameterTypeNotInferred_staticMethod() async {
10970 // Strong mode doesn't do type inference on parameters of static methods, 10972 // Strong mode doesn't do type inference on parameters of static methods,
10971 // so it's ok that we don't store inferred type info for them in summaries. 10973 // so it's ok that we don't store inferred type info for them in summaries.
10972 var library = await checkLibrary(''' 10974 var library = await checkLibrary('''
10973 class C { 10975 class C {
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after
13145 fail('Unexpectedly tried to get unlinked summary for $uri'); 13147 fail('Unexpectedly tried to get unlinked summary for $uri');
13146 } 13148 }
13147 return serializedUnit; 13149 return serializedUnit;
13148 } 13150 }
13149 13151
13150 @override 13152 @override
13151 bool hasLibrarySummary(String uri) { 13153 bool hasLibrarySummary(String uri) {
13152 return true; 13154 return true;
13153 } 13155 }
13154 } 13156 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/element_text.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698