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/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
9 import 'package:analyzer/dart/constant/value.dart'; | 9 import 'package:analyzer/dart/constant/value.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 ExecutableElement original, String desc) { | 881 ExecutableElement original, String desc) { |
882 if (original is! Member) { | 882 if (original is! Member) { |
883 List<FunctionElement> rFunctions = resynthesized.functions; | 883 List<FunctionElement> rFunctions = resynthesized.functions; |
884 List<FunctionElement> oFunctions = original.functions; | 884 List<FunctionElement> oFunctions = original.functions; |
885 expect(rFunctions, hasLength(oFunctions.length)); | 885 expect(rFunctions, hasLength(oFunctions.length)); |
886 for (int i = 0; i < oFunctions.length; i++) { | 886 for (int i = 0; i < oFunctions.length; i++) { |
887 compareFunctionElements(rFunctions[i], oFunctions[i], | 887 compareFunctionElements(rFunctions[i], oFunctions[i], |
888 '$desc local function ${oFunctions[i].name}'); | 888 '$desc local function ${oFunctions[i].name}'); |
889 } | 889 } |
890 } | 890 } |
891 if (original is! Member) { | |
892 List<LabelElement> rLabels = resynthesized.labels; | |
893 List<LabelElement> oLabels = original.labels; | |
894 expect(rLabels, hasLength(oLabels.length)); | |
895 for (int i = 0; i < oLabels.length; i++) { | |
896 compareLabelElements( | |
897 rLabels[i], oLabels[i], '$desc label ${oLabels[i].name}'); | |
898 } | |
899 } | |
900 } | 891 } |
901 | 892 |
902 void compareMetadata(List<ElementAnnotation> resynthesized, | 893 void compareMetadata(List<ElementAnnotation> resynthesized, |
903 List<ElementAnnotation> original, String desc) { | 894 List<ElementAnnotation> original, String desc) { |
904 expect(resynthesized, hasLength(original.length), reason: desc); | 895 expect(resynthesized, hasLength(original.length), reason: desc); |
905 for (int i = 0; i < original.length; i++) { | 896 for (int i = 0; i < original.length; i++) { |
906 compareElementAnnotations( | 897 compareElementAnnotations( |
907 resynthesized[i], original[i], '$desc annotation $i'); | 898 resynthesized[i], original[i], '$desc annotation $i'); |
908 } | 899 } |
909 } | 900 } |
(...skipping 14263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15173 fail('Unexpectedly tried to get unlinked summary for $uri'); | 15164 fail('Unexpectedly tried to get unlinked summary for $uri'); |
15174 } | 15165 } |
15175 return serializedUnit; | 15166 return serializedUnit; |
15176 } | 15167 } |
15177 | 15168 |
15178 @override | 15169 @override |
15179 bool hasLibrarySummary(String uri) { | 15170 bool hasLibrarySummary(String uri) { |
15180 return true; | 15171 return true; |
15181 } | 15172 } |
15182 } | 15173 } |
OLD | NEW |