@@ -51,13 +51,11 @@ import 'package:analyzer/src/summary/idl.dart';
5151import 'package:analyzer/src/summary/package_bundle_reader.dart' ;
5252import 'package:analyzer/src/summary2/ast_binary_flags.dart' ;
5353import 'package:analyzer/src/summary2/bundle_writer.dart' ;
54- import 'package:analyzer/src/summary2/macro.dart' ;
5554import 'package:analyzer/src/summary2/package_bundle_format.dart' ;
5655import 'package:analyzer/src/util/file_paths.dart' as file_paths;
5756import 'package:analyzer/src/util/performance/operation_performance.dart' ;
5857import 'package:analyzer/src/utilities/extensions/async.dart' ;
5958import 'package:analyzer/src/utilities/extensions/collection.dart' ;
60- import 'package:analyzer/src/utilities/extensions/string.dart' ;
6159import 'package:analyzer/src/utilities/uri_cache.dart' ;
6260import 'package:analyzer/src/workspace/pub.dart' ;
6361import 'package:collection/collection.dart' ;
@@ -99,7 +97,7 @@ import 'package:meta/meta.dart';
9997// TODO(scheglov): Clean up the list of implicitly analyzed files.
10098class AnalysisDriver {
10199 /// The version of data format, should be incremented on every format change.
102- static const int DATA_VERSION = 427 ;
100+ static const int DATA_VERSION = 428 ;
103101
104102 /// The number of exception contexts allowed to write. Once this field is
105103 /// zero, we stop writing any new exception contexts in this process.
@@ -147,9 +145,6 @@ class AnalysisDriver {
147145 /// from file paths.
148146 final SourceFactory _sourceFactory;
149147
150- /// The support for executing macros.
151- final MacroSupport ? macroSupport;
152-
153148 /// The container, shared with other drivers within the same collection,
154149 /// into which all drivers record files ownership.
155150 final OwnedFiles ? ownedFiles;
@@ -281,7 +276,6 @@ class AnalysisDriver {
281276 required ByteStore byteStore,
282277 required SourceFactory sourceFactory,
283278 required Packages packages,
284- this .macroSupport,
285279 this .ownedFiles,
286280 this .analysisContext,
287281 @Deprecated ("Use 'analysisOptionsMap' instead" )
@@ -394,7 +388,6 @@ class AnalysisDriver {
394388 analysisOptionsMap: analysisOptionsMap,
395389 declaredVariables: declaredVariables,
396390 sourceFactory: _sourceFactory,
397- macroSupport: macroSupport,
398391 packagesFile: analysisContext? .contextRoot.packagesFile,
399392 externalSummaries: _externalSummaries,
400393 fileSystemState: _fsState,
@@ -803,12 +796,6 @@ class AnalysisDriver {
803796 );
804797 }
805798
806- // If a macro generated file, request its library instead.
807- var file = resourceProvider.getFile (path);
808- if (file.libraryForMacro case var library? ) {
809- _errorsRequestedFiles.addKey (library.path);
810- }
811-
812799 // Schedule analysis.
813800 var completer = Completer <SomeErrorsResult >();
814801 _errorsRequestedFiles.add (path, completer);
@@ -866,12 +853,6 @@ class AnalysisDriver {
866853 return Future .value ();
867854 }
868855
869- // If a macro generated file, request its library instead.
870- var file = resourceProvider.getFile (path);
871- if (file.libraryForMacro case var library? ) {
872- _indexRequestedFiles.addKey (library.path);
873- }
874-
875856 // Schedule analysis.
876857 var completer = Completer <AnalysisDriverUnitIndex ?>();
877858 _indexRequestedFiles.add (path, completer);
@@ -1096,12 +1077,6 @@ class AnalysisDriver {
10961077 );
10971078 }
10981079
1099- // If a macro generated file, request its library instead.
1100- var file = resourceProvider.getFile (path);
1101- if (file.libraryForMacro case var library? ) {
1102- _requestedFiles.addKey (library.path);
1103- }
1104-
11051080 // Schedule analysis.
11061081 var completer = Completer <SomeResolvedUnitResult >();
11071082 _requestedFiles.add (path, completer);
@@ -1139,13 +1114,6 @@ class AnalysisDriver {
11391114 );
11401115 }
11411116
1142- // If a macro generated file, request its library.
1143- // Once the library is ready, we can return the requested result.
1144- var file = resourceProvider.getFile (path);
1145- if (file.libraryForMacro case var library? ) {
1146- _unitElementRequestedFiles.addKey (library.path);
1147- }
1148-
11491117 // Schedule analysis.
11501118 var completer = Completer <SomeUnitElementResult >();
11511119 _unitElementRequestedFiles.add (path, completer);
@@ -1585,7 +1553,6 @@ class AnalysisDriver {
15851553 lineInfo: file.lineInfo,
15861554 uri: file.uri,
15871555 isLibrary: file.kind is LibraryFileKind ,
1588- isMacroPart: file.isMacroPart,
15891556 isPart: file.kind is PartFileKind ,
15901557 errors: errors,
15911558 analysisOptions: file.analysisOptions,
@@ -1673,24 +1640,6 @@ class AnalysisDriver {
16731640 }
16741641 }
16751642
1676- Future <void > _ensureMacroGeneratedFiles () async {
1677- for (var file in knownFiles.toList ()) {
1678- if (file.kind case LibraryFileKind libraryKind) {
1679- var libraryCycle = libraryKind.libraryCycle;
1680- if (libraryCycle.importsMacroClass) {
1681- if (! libraryCycle.hasMacroFilesCreated) {
1682- libraryCycle.hasMacroFilesCreated = true ;
1683- // We create macro-generated FileState(s) when load bundles.
1684- await libraryContext.load (
1685- targetLibrary: libraryKind,
1686- performance: OperationPerformanceImpl ('<root>' ),
1687- );
1688- }
1689- }
1690- }
1691- }
1692- }
1693-
16941643 Future <void > _getErrors (String path) async {
16951644 var file = _fsState.getFileForPath (path);
16961645
@@ -1728,8 +1677,6 @@ class AnalysisDriver {
17281677 Future <void > _getFilesDefiningClassMemberName (
17291678 _GetFilesDefiningClassMemberNameRequest request,
17301679 ) async {
1731- await _ensureMacroGeneratedFiles ();
1732-
17331680 var result = < FileState > [];
17341681 for (var file in knownFiles) {
17351682 if (file.definedClassMemberNames.contains (request.name)) {
@@ -1742,8 +1689,6 @@ class AnalysisDriver {
17421689 Future <void > _getFilesReferencingName (
17431690 _GetFilesReferencingNameRequest request,
17441691 ) async {
1745- await _ensureMacroGeneratedFiles ();
1746-
17471692 var result = < FileState > [];
17481693 for (var file in knownFiles) {
17491694 if (file.referencedNames.contains (request.name)) {
@@ -1899,7 +1844,6 @@ class AnalysisDriver {
18991844 lineInfo: file.lineInfo,
19001845 uri: file.uri,
19011846 isLibrary: file.kind is LibraryFileKind ,
1902- isMacroPart: file.isMacroPart,
19031847 isPart: file.kind is PartFileKind ,
19041848 errors: [
19051849 AnalysisError .tmp (
@@ -2673,21 +2617,3 @@ extension<K, V> on Map<K, List<Completer<V>>> {
26732617 remove (key)? .completeAll (value);
26742618 }
26752619}
2676-
2677- extension FileExtension on File {
2678- File ? get libraryForMacro {
2679- if (path.removeSuffix ('.macro.dart' ) case var noExtPath? ) {
2680- var libraryPath = '$noExtPath .dart' ;
2681- return provider.getFile (libraryPath);
2682- }
2683- return null ;
2684- }
2685-
2686- File ? get macroForLibrary {
2687- if (path.removeSuffix ('.dart' ) case var noExtPath? ) {
2688- var libraryPath = '$noExtPath .macro.dart' ;
2689- return provider.getFile (libraryPath);
2690- }
2691- return null ;
2692- }
2693- }
0 commit comments