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

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

Issue 1643283002: Resynthesize typed constant lists and maps. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/lib/src/summary/resynthesize.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 '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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 const vInt = 1; 1018 const vInt = 1;
1019 const vIntLong = 0x9876543210987654321; 1019 const vIntLong = 0x9876543210987654321;
1020 const vDouble = 2.3; 1020 const vDouble = 2.3;
1021 const vString = 'abc'; 1021 const vString = 'abc';
1022 const vStringConcat = 'aaa' 'bbb'; 1022 const vStringConcat = 'aaa' 'bbb';
1023 const vStringInterpolation = 'aaa ${true} ${42} bbb'; 1023 const vStringInterpolation = 'aaa ${true} ${42} bbb';
1024 const vSymbol = #aaa.bbb.ccc; 1024 const vSymbol = #aaa.bbb.ccc;
1025 '''); 1025 ''');
1026 } 1026 }
1027 1027
1028 test_const_topLevel_typedList() {
1029 shouldCompareConstValues = true;
1030 checkLibrary(r'''
1031 const vNull = const <Null>[];
1032 const vDynamic = const <dynamic>[1, 2, 3];
1033 const vInterfaceNoTypeParameters = const <int>[1, 2, 3];
1034 const vInterfaceNoTypeArguments = const <List>[];
1035 const vInterfaceWithTypeArguments = const <List<String>>[];
1036 const vInterfaceWithTypeArguments2 = const <Map<int, List<String>>>[];
1037 ''');
1038 }
1039
1040 test_const_topLevel_typedList_imported() {
1041 shouldCompareConstValues = true;
1042 addNamedSource('/a.dart', 'class C {}');
1043 checkLibrary(r'''
1044 import 'a.dart';
1045 const v = const <C>[];
1046 ''');
1047 }
1048
1049 test_const_topLevel_typedList_importedWithPrefix() {
1050 shouldCompareConstValues = true;
1051 addNamedSource('/a.dart', 'class C {}');
1052 checkLibrary(r'''
1053 import 'a.dart' as p;
1054 const v = const <p.C>[];
1055 ''');
1056 }
1057
1058 test_const_topLevel_typedMap() {
1059 shouldCompareConstValues = true;
1060 checkLibrary(r'''
1061 const vDynamic1 = const <dynamic, int>{};
1062 const vDynamic2 = const <int, dynamic>{};
1063 const vInterface = const <int, String>{};
1064 const vInterfaceWithTypeArguments = const <int, List<String>>{};
1065 ''');
1066 }
1067
1028 test_const_topLevel_unary() { 1068 test_const_topLevel_unary() {
1029 shouldCompareConstValues = true; 1069 shouldCompareConstValues = true;
1030 checkLibrary(r''' 1070 checkLibrary(r'''
1031 const vNotEqual = 1 != 2; 1071 const vNotEqual = 1 != 2;
1032 const vNot = !true; 1072 const vNot = !true;
1033 const vNegate = -1; 1073 const vNegate = -1;
1034 const vComplement = ~1; 1074 const vComplement = ~1;
1035 '''); 1075 ''');
1036 } 1076 }
1037 1077
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 fail('Unexpectedly tried to get unlinked summary for $uri'); 2029 fail('Unexpectedly tried to get unlinked summary for $uri');
1990 } 2030 }
1991 return serializedUnit; 2031 return serializedUnit;
1992 } 2032 }
1993 2033
1994 @override 2034 @override
1995 bool hasLibrarySummary(String uri) { 2035 bool hasLibrarySummary(String uri) {
1996 return true; 2036 return true;
1997 } 2037 }
1998 } 2038 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698