@@ -7,6 +7,7 @@ import 'dart:typed_data';
77
88import 'package:analyzer/file_system/file_system.dart' ;
99import 'package:analyzer/src/dart/analysis/byte_store.dart' ;
10+ import 'package:analyzer/src/dart/analysis/driver.dart' ;
1011import 'package:analyzer/src/dart/analysis/file_state.dart' ;
1112import 'package:analyzer/src/dart/analysis/library_graph.dart' ;
1213import 'package:analyzer/src/dart/analysis/performance_logger.dart' ;
@@ -117,8 +118,13 @@ var G, H;
117118 expect (_excludeSdk (file.directReferencedFiles), isEmpty);
118119 expect (file.isPart, isFalse);
119120 expect (file.library, isNull);
120- expect (file.unlinked, isNotNull);
121- expect (file.unlinked.classes, isEmpty);
121+ if (AnalysisDriver .useSummary2) {
122+ expect (file.unlinked2, isNotNull);
123+ expect (file.unlinked2.exports, isEmpty);
124+ } else {
125+ expect (file.unlinked, isNotNull);
126+ expect (file.unlinked.classes, isEmpty);
127+ }
122128 }
123129
124130 test_getFileForPath_emptyUri () {
@@ -208,9 +214,13 @@ class A1 {}
208214
209215 expect (file.isPart, isFalse);
210216 expect (file.library, isNull);
211- expect (file.unlinked, isNotNull);
212- expect (file.unlinked.classes, hasLength (1 ));
213- expect (file.unlinked.classes[0 ].name, 'A1' );
217+ if (AnalysisDriver .useSummary2) {
218+ expect (file.unlinked2, isNotNull);
219+ } else {
220+ expect (file.unlinked, isNotNull);
221+ expect (file.unlinked.classes, hasLength (1 ));
222+ expect (file.unlinked.classes[0 ].name, 'A1' );
223+ }
214224
215225 expect (_excludeSdk (file.importedFiles), hasLength (2 ));
216226 expect (file.importedFiles[0 ].path, a2);
@@ -281,9 +291,13 @@ class A2 {}
281291 expect (file_a2.path, a2);
282292 expect (file_a2.uri, Uri .parse ('package:aaa/a2.dart' ));
283293
284- expect (file_a2.unlinked, isNotNull);
285- expect (file_a2.unlinked.classes, hasLength (1 ));
286- expect (file_a2.unlinked.classes[0 ].name, 'A2' );
294+ if (AnalysisDriver .useSummary2) {
295+ expect (file_a2.unlinked2, isNotNull);
296+ } else {
297+ expect (file_a2.unlinked, isNotNull);
298+ expect (file_a2.unlinked.classes, hasLength (1 ));
299+ expect (file_a2.unlinked.classes[0 ].name, 'A2' );
300+ }
287301
288302 expect (_excludeSdk (file_a2.importedFiles), isEmpty);
289303 expect (file_a2.exportedFiles, isEmpty);
@@ -500,7 +514,11 @@ A foo(B p) {
500514class A {}
501515''' );
502516 FileState file = fileSystemState.getFileForPath (path);
503- expect (file.unlinked.classes[0 ].name, 'A' );
517+ if (AnalysisDriver .useSummary2) {
518+ expect (file.definedTopLevelNames, contains ('A' ));
519+ } else {
520+ expect (file.unlinked.classes[0 ].name, 'A' );
521+ }
504522 List <int > signature = file.apiSignature;
505523
506524 // Update the resource and refresh the file state.
@@ -510,7 +528,11 @@ class B {}
510528 bool apiSignatureChanged = file.refresh ();
511529 expect (apiSignatureChanged, isTrue);
512530
513- expect (file.unlinked.classes[0 ].name, 'B' );
531+ if (AnalysisDriver .useSummary2) {
532+ expect (file.definedTopLevelNames, contains ('B' ));
533+ } else {
534+ expect (file.unlinked.classes[0 ].name, 'B' );
535+ }
514536 expect (file.apiSignature, isNot (signature));
515537 }
516538
@@ -546,14 +568,22 @@ class C {
546568
547569 // Get the file, prepare unlinked.
548570 FileState file = fileSystemState.getFileForPath (path);
549- expect (file.unlinked, isNotNull);
571+ if (AnalysisDriver .useSummary2) {
572+ expect (file.unlinked2, isNotNull);
573+ } else {
574+ expect (file.unlinked, isNotNull);
575+ }
550576
551577 // Make the unlinked unit in the byte store zero-length, damaged.
552578 byteStore.put (file.test.unlinkedKey, < int > []);
553579
554580 // Refresh should not fail, zero bytes in the store are ignored.
555581 file.refresh ();
556- expect (file.unlinked, isNotNull);
582+ if (AnalysisDriver .useSummary2) {
583+ expect (file.unlinked2, isNotNull);
584+ } else {
585+ expect (file.unlinked, isNotNull);
586+ }
557587 }
558588
559589 test_subtypedNames () {
0 commit comments