| 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/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/dart/element/type.dart'; | 9 import 'package:analyzer/dart/element/type.dart'; |
| 10 import 'package:analyzer/src/dart/element/element.dart'; | 10 import 'package:analyzer/src/dart/element/element.dart'; |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 expect(resynthesized.parameters.length, original.parameters.length); | 330 expect(resynthesized.parameters.length, original.parameters.length); |
| 331 for (int i = 0; i < resynthesized.parameters.length; i++) { | 331 for (int i = 0; i < resynthesized.parameters.length; i++) { |
| 332 compareParameterElements( | 332 compareParameterElements( |
| 333 resynthesized.parameters[i], | 333 resynthesized.parameters[i], |
| 334 original.parameters[i], | 334 original.parameters[i], |
| 335 '$desc parameter ${original.parameters[i].name}'); | 335 '$desc parameter ${original.parameters[i].name}'); |
| 336 } | 336 } |
| 337 compareTypes( | 337 compareTypes( |
| 338 resynthesized.returnType, original.returnType, '$desc return type'); | 338 resynthesized.returnType, original.returnType, '$desc return type'); |
| 339 compareTypes(resynthesized.type, original.type, desc); | 339 compareTypes(resynthesized.type, original.type, desc); |
| 340 expect(resynthesized.typeParameters.length, original.typeParameters.length); |
| 341 for (int i = 0; i < resynthesized.typeParameters.length; i++) { |
| 342 compareTypeParameterElements( |
| 343 resynthesized.typeParameters[i], |
| 344 original.typeParameters[i], |
| 345 '$desc type parameter ${original.typeParameters[i].name}'); |
| 346 } |
| 340 } | 347 } |
| 341 | 348 |
| 342 void compareExportElements(ExportElementImpl resynthesized, | 349 void compareExportElements(ExportElementImpl resynthesized, |
| 343 ExportElementImpl original, String desc) { | 350 ExportElementImpl original, String desc) { |
| 344 compareUriReferencedElements(resynthesized, original, desc); | 351 compareUriReferencedElements(resynthesized, original, desc); |
| 345 expect(resynthesized.exportedLibrary.location, | 352 expect(resynthesized.exportedLibrary.location, |
| 346 original.exportedLibrary.location); | 353 original.exportedLibrary.location); |
| 347 expect(resynthesized.combinators.length, original.combinators.length); | 354 expect(resynthesized.combinators.length, original.combinators.length); |
| 348 for (int i = 0; i < resynthesized.combinators.length; i++) { | 355 for (int i = 0; i < resynthesized.combinators.length; i++) { |
| 349 compareNamespaceCombinators( | 356 compareNamespaceCombinators( |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 for (int i = 0; i < resynthesized.combinators.length; i++) { | 409 for (int i = 0; i < resynthesized.combinators.length; i++) { |
| 403 compareNamespaceCombinators( | 410 compareNamespaceCombinators( |
| 404 resynthesized.combinators[i], original.combinators[i]); | 411 resynthesized.combinators[i], original.combinators[i]); |
| 405 } | 412 } |
| 406 } | 413 } |
| 407 | 414 |
| 408 void compareMethodElements(MethodElementImpl resynthesized, | 415 void compareMethodElements(MethodElementImpl resynthesized, |
| 409 MethodElementImpl original, String desc) { | 416 MethodElementImpl original, String desc) { |
| 410 // TODO(paulberry): do we need to deal with | 417 // TODO(paulberry): do we need to deal with |
| 411 // MultiplyInheritedMethodElementImpl? | 418 // MultiplyInheritedMethodElementImpl? |
| 412 // TODO(paulberry): compare type parameters for generic methods. | |
| 413 compareExecutableElements(resynthesized, original, desc); | 419 compareExecutableElements(resynthesized, original, desc); |
| 414 } | 420 } |
| 415 | 421 |
| 416 void compareNamespaceCombinators( | 422 void compareNamespaceCombinators( |
| 417 NamespaceCombinator resynthesized, NamespaceCombinator original) { | 423 NamespaceCombinator resynthesized, NamespaceCombinator original) { |
| 418 if (original is ShowElementCombinatorImpl && | 424 if (original is ShowElementCombinatorImpl && |
| 419 resynthesized is ShowElementCombinatorImpl) { | 425 resynthesized is ShowElementCombinatorImpl) { |
| 420 expect(resynthesized.shownNames, original.shownNames); | 426 expect(resynthesized.shownNames, original.shownNames); |
| 421 } else if (original is HideElementCombinatorImpl && | 427 } else if (original is HideElementCombinatorImpl && |
| 422 resynthesized is HideElementCombinatorImpl) { | 428 resynthesized is HideElementCombinatorImpl) { |
| (...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 fail('Unexpectedly tried to get unlinked summary for $uri'); | 2217 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 2212 } | 2218 } |
| 2213 return serializedUnit; | 2219 return serializedUnit; |
| 2214 } | 2220 } |
| 2215 | 2221 |
| 2216 @override | 2222 @override |
| 2217 bool hasLibrarySummary(String uri) { | 2223 bool hasLibrarySummary(String uri) { |
| 2218 return true; | 2224 return true; |
| 2219 } | 2225 } |
| 2220 } | 2226 } |
| OLD | NEW |