| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 expect(r.hasBeenInferred, o.hasBeenInferred, reason: desc); | 253 expect(r.hasBeenInferred, o.hasBeenInferred, reason: desc); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 void compareCompilationUnitElements(CompilationUnitElementImpl resynthesized, | 257 void compareCompilationUnitElements(CompilationUnitElementImpl resynthesized, |
| 258 CompilationUnitElementImpl original) { | 258 CompilationUnitElementImpl original) { |
| 259 String desc = 'Compilation unit ${original.source.uri}'; | 259 String desc = 'Compilation unit ${original.source.uri}'; |
| 260 compareUriReferencedElements(resynthesized, original, desc); | 260 compareUriReferencedElements(resynthesized, original, desc); |
| 261 expect(resynthesized.source, original.source); | 261 expect(resynthesized.source, original.source); |
| 262 expect(resynthesized.librarySource, original.librarySource); | 262 expect(resynthesized.librarySource, original.librarySource); |
| 263 compareLineInfo(resynthesized.lineInfo, original.lineInfo); |
| 263 expect(resynthesized.types.length, original.types.length, | 264 expect(resynthesized.types.length, original.types.length, |
| 264 reason: '$desc types'); | 265 reason: '$desc types'); |
| 265 for (int i = 0; i < resynthesized.types.length; i++) { | 266 for (int i = 0; i < resynthesized.types.length; i++) { |
| 266 compareClassElements( | 267 compareClassElements( |
| 267 resynthesized.types[i], original.types[i], original.types[i].name); | 268 resynthesized.types[i], original.types[i], original.types[i].name); |
| 268 } | 269 } |
| 269 expect(resynthesized.topLevelVariables.length, | 270 expect(resynthesized.topLevelVariables.length, |
| 270 original.topLevelVariables.length, | 271 original.topLevelVariables.length, |
| 271 reason: '$desc topLevelVariables'); | 272 reason: '$desc topLevelVariables'); |
| 272 for (int i = 0; i < resynthesized.topLevelVariables.length; i++) { | 273 for (int i = 0; i < resynthesized.topLevelVariables.length; i++) { |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 | 815 |
| 815 void compareLabelElements( | 816 void compareLabelElements( |
| 816 LabelElementImpl resynthesized, LabelElementImpl original, String desc) { | 817 LabelElementImpl resynthesized, LabelElementImpl original, String desc) { |
| 817 expect(resynthesized.isOnSwitchMember, original.isOnSwitchMember, | 818 expect(resynthesized.isOnSwitchMember, original.isOnSwitchMember, |
| 818 reason: desc); | 819 reason: desc); |
| 819 expect(resynthesized.isOnSwitchStatement, original.isOnSwitchStatement, | 820 expect(resynthesized.isOnSwitchStatement, original.isOnSwitchStatement, |
| 820 reason: desc); | 821 reason: desc); |
| 821 compareElements(resynthesized, original, desc); | 822 compareElements(resynthesized, original, desc); |
| 822 } | 823 } |
| 823 | 824 |
| 825 void compareLineInfo(LineInfo resynthesized, LineInfo original) { |
| 826 expect(resynthesized.lineCount, original.lineCount); |
| 827 expect(resynthesized.lineStarts, original.lineStarts); |
| 828 } |
| 829 |
| 824 void compareLocalElementsOfExecutable(ExecutableElement resynthesized, | 830 void compareLocalElementsOfExecutable(ExecutableElement resynthesized, |
| 825 ExecutableElement original, String desc) { | 831 ExecutableElement original, String desc) { |
| 826 if (original is! Member) { | 832 if (original is! Member) { |
| 827 List<FunctionElement> rFunctions = resynthesized.functions; | 833 List<FunctionElement> rFunctions = resynthesized.functions; |
| 828 List<FunctionElement> oFunctions = original.functions; | 834 List<FunctionElement> oFunctions = original.functions; |
| 829 expect(rFunctions, hasLength(oFunctions.length)); | 835 expect(rFunctions, hasLength(oFunctions.length)); |
| 830 for (int i = 0; i < oFunctions.length; i++) { | 836 for (int i = 0; i < oFunctions.length; i++) { |
| 831 compareFunctionElements(rFunctions[i], oFunctions[i], | 837 compareFunctionElements(rFunctions[i], oFunctions[i], |
| 832 '$desc local function ${oFunctions[i].name}'); | 838 '$desc local function ${oFunctions[i].name}'); |
| 833 } | 839 } |
| (...skipping 4430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5264 fail('Unexpectedly tried to get unlinked summary for $uri'); | 5270 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 5265 } | 5271 } |
| 5266 return serializedUnit; | 5272 return serializedUnit; |
| 5267 } | 5273 } |
| 5268 | 5274 |
| 5269 @override | 5275 @override |
| 5270 bool hasLibrarySummary(String uri) { | 5276 bool hasLibrarySummary(String uri) { |
| 5271 return true; | 5277 return true; |
| 5272 } | 5278 } |
| 5273 } | 5279 } |
| OLD | NEW |