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

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

Issue 1603643007: Properly resynthesize field formal parameter elements. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 ParameterElementImpl original, String desc) { 347 ParameterElementImpl original, String desc) {
348 compareVariableElements(resynthesized, original, desc); 348 compareVariableElements(resynthesized, original, desc);
349 expect(resynthesized.parameters.length, original.parameters.length); 349 expect(resynthesized.parameters.length, original.parameters.length);
350 for (int i = 0; i < resynthesized.parameters.length; i++) { 350 for (int i = 0; i < resynthesized.parameters.length; i++) {
351 compareParameterElements( 351 compareParameterElements(
352 resynthesized.parameters[i], 352 resynthesized.parameters[i],
353 original.parameters[i], 353 original.parameters[i],
354 '$desc parameter ${original.parameters[i].name}'); 354 '$desc parameter ${original.parameters[i].name}');
355 } 355 }
356 expect(resynthesized.parameterKind, original.parameterKind); 356 expect(resynthesized.parameterKind, original.parameterKind);
357 expect(resynthesized.isInitializingFormal, original.isInitializingFormal,
358 reason: desc);
359 expect(resynthesized is FieldFormalParameterElementImpl,
360 original is FieldFormalParameterElementImpl);
361 if (resynthesized is FieldFormalParameterElementImpl &&
362 original is FieldFormalParameterElementImpl) {
363 if (original.field == null) {
364 expect(resynthesized.field, isNull, reason: '$desc field');
365 } else {
366 expect(resynthesized.field, isNotNull, reason: '$desc field');
367 compareFieldElements(
368 resynthesized.field, original.field, '$desc field');
369 }
370 }
357 } 371 }
358 372
359 void comparePrefixElements(PrefixElementImpl resynthesized, 373 void comparePrefixElements(PrefixElementImpl resynthesized,
360 PrefixElementImpl original, String desc) { 374 PrefixElementImpl original, String desc) {
361 compareElements(resynthesized, original, desc); 375 compareElements(resynthesized, original, desc);
362 // TODO(paulberry): test _importedLibraries. 376 // TODO(paulberry): test _importedLibraries.
363 } 377 }
364 378
365 void comparePropertyAccessorElements( 379 void comparePropertyAccessorElements(
366 PropertyAccessorElementImpl resynthesized, 380 PropertyAccessorElementImpl resynthesized,
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 fail('Unexpectedly tried to get unlinked summary for $uri'); 1628 fail('Unexpectedly tried to get unlinked summary for $uri');
1615 } 1629 }
1616 return serializedUnit; 1630 return serializedUnit;
1617 } 1631 }
1618 1632
1619 @override 1633 @override
1620 bool hasLibrarySummary(String uri) { 1634 bool hasLibrarySummary(String uri) {
1621 return true; 1635 return true;
1622 } 1636 }
1623 } 1637 }
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