@@ -379,7 +379,11 @@ class VerificationState {
379379 node.parent is Block &&
380380 node.name != null ||
381381 node is YieldStatement ||
382- node is IfStatement ;
382+ node is IfStatement ||
383+ node is WhileStatement ||
384+ node is DoStatement ||
385+ node is ForStatement ||
386+ node is ForInStatement && ! node.isAsync;
383387
384388 static bool isSupported (Node node) =>
385389 node is DartType && isDartTypeSupported (node) ||
@@ -396,7 +400,7 @@ class TextSerializationVerifier extends RecursiveVisitor<void> {
396400 defaultValue: false );
397401
398402 /// List of status for all round-trip serialization attempts.
399- final List <RoundTripStatus > status = < RoundTripStatus > [];
403+ final List <RoundTripStatus > _status = < RoundTripStatus > [];
400404
401405 final CanonicalName root;
402406
@@ -408,7 +412,9 @@ class TextSerializationVerifier extends RecursiveVisitor<void> {
408412 }
409413
410414 /// List of errors produced during round trips on the visited nodes.
411- Iterable <RoundTripStatus > get failures => status.where ((s) => s.isFailure);
415+ Iterable <RoundTripStatus > get _failures => _status.where ((s) => s.isFailure);
416+
417+ List <RoundTripStatus > get failures => _failures.toList ()..sort ();
412418
413419 VerificationState get currentState => _stateStackTop;
414420
@@ -472,17 +478,17 @@ class TextSerializationVerifier extends RecursiveVisitor<void> {
472478 } catch (exception, stackTrace) {
473479 String message =
474480 showStackTrace ? "${exception }\n ${stackTrace }" : "${exception }" ;
475- status .add (new RoundTripDeserializationFailure (node, message,
481+ _status .add (new RoundTripDeserializationFailure (node, message,
476482 context: lastSeenTreeNodeWithLocation));
477483 return null ;
478484 }
479485 if (stream.moveNext ()) {
480- status .add (new RoundTripDeserializationFailure (
486+ _status .add (new RoundTripDeserializationFailure (
481487 node, "unexpected trailing text" ,
482488 context: lastSeenTreeNodeWithLocation));
483489 }
484490 if (result == null ) {
485- status .add (new RoundTripDeserializationFailure (
491+ _status .add (new RoundTripDeserializationFailure (
486492 node, "Deserialization of the following returned null: '${input }'" ,
487493 context: lastSeenTreeNodeWithLocation));
488494 }
@@ -497,7 +503,7 @@ class TextSerializationVerifier extends RecursiveVisitor<void> {
497503 } catch (exception, stackTrace) {
498504 String message =
499505 showStackTrace ? "${exception }\n ${stackTrace }" : "${exception }" ;
500- status .add (new RoundTripInitialSerializationFailure (node, message,
506+ _status .add (new RoundTripInitialSerializationFailure (node, message,
501507 context: lastSeenTreeNodeWithLocation));
502508 }
503509 return buffer.toString ();
@@ -524,15 +530,15 @@ class TextSerializationVerifier extends RecursiveVisitor<void> {
524530 }
525531
526532 void makeRoundTrip <T extends Node >(T node, TextSerializer <T > serializer) {
527- int failureCount = failures .length;
533+ int failureCount = _failures .length;
528534 String initial = writeNode (node, serializer);
529- if (failures .length != failureCount) {
535+ if (_failures .length != failureCount) {
530536 return ;
531537 }
532538
533539 // Do the round trip.
534540 T deserialized = readNode (node, initial, serializer);
535- if (failures .length != failureCount) {
541+ if (_failures .length != failureCount) {
536542 return ;
537543 }
538544
@@ -542,17 +548,23 @@ class TextSerializationVerifier extends RecursiveVisitor<void> {
542548 }
543549
544550 String serialized = writeNode (deserialized, serializer);
545- if (failures .length != failureCount) {
551+ if (_failures .length != failureCount) {
546552 return ;
547553 }
548554
549555 if (initial != serialized) {
550- status .add (new RoundTripSecondSerializationFailure (
556+ _status .add (new RoundTripSecondSerializationFailure (
551557 node, initial, serialized,
552558 context: lastSeenTreeNodeWithLocation));
553559 } else {
554- status .add (new RoundTripSuccess (node, initial,
560+ _status .add (new RoundTripSuccess (node, initial,
555561 context: lastSeenTreeNodeWithLocation));
556562 }
557563 }
564+
565+ List <RoundTripStatus > takeStatus () {
566+ List <RoundTripStatus > result = _status.toList ()..sort ();
567+ _status.clear ();
568+ return result;
569+ }
558570}
0 commit comments