Skip to content

Commit 5874342

Browse files
scheglovCommit Queue
authored andcommitted
Augment. Remove redundant forAugmentationLibrary flag, use libraryFeatures.augmentations instead.
Change-Id: If6e5ce47e93d95c33ad796d21888d26d93f46735 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489980 Reviewed-by: Paul Berry <paulberry@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
1 parent 15cdd91 commit 5874342

8 files changed

Lines changed: 9 additions & 29 deletions

pkg/front_end/lib/src/base/incremental_compiler.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,6 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
21272127
conditionalImportSupported:
21282128
libraryBuilder.conditionalImportSupported,
21292129
importability: libraryBuilder.importability,
2130-
forAugmentationLibrary: false,
21312130
forPatchLibrary: false,
21322131
referenceIsPartOwner: null,
21332132
packageUri: null,
@@ -2193,7 +2192,6 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
21932192
parentExtensionScope: debugCompilationUnit.extensionScope,
21942193
conditionalImportSupported: libraryBuilder.conditionalImportSupported,
21952194
importability: libraryBuilder.importability,
2196-
forAugmentationLibrary: false,
21972195
forPatchLibrary: false,
21982196
referenceIsPartOwner: null,
21992197
packageUri: null,

pkg/front_end/lib/src/builder/compilation_unit.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,6 @@ abstract class SourceCompilationUnit
155155
int length = noLength,
156156
});
157157

158-
// TODO(johnniwinther): Remove this.
159-
bool get forAugmentationLibrary;
160-
161158
// TODO(johnniwinther): Remove this.
162159
bool get forPatchLibrary;
163160

pkg/front_end/lib/src/source/fragment_factory_impl.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,6 @@ class FragmentFactoryImpl implements FragmentFactory {
976976
_augmentationRoot
977977
: null,
978978
accessor: _compilationUnit,
979-
isAugmentation: isAugmentationImport,
980979
referencesFromIndex: isAugmentationImport
981980
?
982981
// Coverage-ignore(suite): Not run.

pkg/front_end/lib/src/source/source_compilation_unit.dart

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit {
160160

161161
LibraryFeatures? _libraryFeatures;
162162

163-
@override
164-
final bool forAugmentationLibrary;
165-
166163
@override
167164
final bool forPatchLibrary;
168165

@@ -194,7 +191,6 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit {
194191
Map<String, Builder>? omittedTypeDeclarationBuilders,
195192
LookupScope? parentScope,
196193
ExtensionScope? parentExtensionScope,
197-
required bool forAugmentationLibrary,
198194
required SourceCompilationUnit? augmentationRoot,
199195
required LibraryBuilder? resolveInLibrary,
200196
required bool? referenceIsPartOwner,
@@ -221,7 +217,6 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit {
221217
parentExtensionScope: parentExtensionScope,
222218
importNameSpace: importNameSpace,
223219
prefixNameSpace: prefixNameSpace,
224-
forAugmentationLibrary: forAugmentationLibrary,
225220
augmentationRoot: augmentationRoot,
226221
resolveInLibrary: resolveInLibrary,
227222
referenceIsPartOwner: referenceIsPartOwner,
@@ -246,7 +241,6 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit {
246241
ExtensionScope? parentExtensionScope,
247242
required ComputedMutableNameSpace importNameSpace,
248243
required ComputedMutableNameSpace prefixNameSpace,
249-
required this.forAugmentationLibrary,
250244
required SourceCompilationUnit? augmentationRoot,
251245
required LibraryBuilder? resolveInLibrary,
252246
required bool? referenceIsPartOwner,
@@ -668,7 +662,7 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit {
668662
indexedLibrary: indexedLibrary,
669663
referenceIsPartOwner: _referenceIsPartOwner,
670664
conditionalImportSupported: conditionalImportSupported,
671-
isAugmentation: forAugmentationLibrary,
665+
isAugmentation: isAugmenting,
672666
isPatch: forPatchLibrary,
673667
parentScope: _parentScope,
674668
parentExtensionScope: _parentExtensionScope,
@@ -1233,7 +1227,6 @@ class SourceCompilationUnitImpl implements SourceCompilationUnit {
12331227
-1,
12341228
origin: null,
12351229
accessor: this,
1236-
isAugmentation: false,
12371230
referencesFromIndex: indexedLibrary,
12381231
);
12391232
Import import = new Import(

pkg/front_end/lib/src/source/source_library_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
338338

339339
// Coverage-ignore(suite): Not run.
340340
/// `true` if this is an augmentation library.
341-
bool get isAugmentationLibrary => compilationUnit.forAugmentationLibrary;
341+
bool get isAugmentationLibrary => compilationUnit.isAugmenting;
342342

343343
// Coverage-ignore(suite): Not run.
344344
/// `true` if this is a patch library.

pkg/front_end/lib/src/source/source_loader.dart

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ class SourceLoader extends Loader implements ProblemReportingHelper {
410410
SourceCompilationUnit? origin,
411411
IndexedLibrary? referencesFromIndex,
412412
bool? referenceIsPartOwner,
413-
bool isAugmentation = false,
414413
bool isPatch = false,
415414
required bool mayImplementRestrictedTypes,
416415
}) {
@@ -435,7 +434,6 @@ class SourceLoader extends Loader implements ProblemReportingHelper {
435434
? target.uriTranslator.isLibraryImportable(importUri.path)
436435
: Importability.always),
437436
isAugmenting: origin != null,
438-
forAugmentationLibrary: isAugmentation,
439437
forPatchLibrary: isPatch,
440438
mayImplementRestrictedTypes: mayImplementRestrictedTypes,
441439
);
@@ -484,7 +482,6 @@ class SourceLoader extends Loader implements ProblemReportingHelper {
484482
required SourceCompilationUnit? origin,
485483
required IndexedLibrary? referencesFromIndex,
486484
required bool? referenceIsPartOwner,
487-
required bool isAugmentation,
488485
required bool isPatch,
489486
required bool addAsRoot,
490487
}) {
@@ -606,7 +603,6 @@ class SourceLoader extends Loader implements ProblemReportingHelper {
606603
origin: origin,
607604
referencesFromIndex: referencesFromIndex,
608605
referenceIsPartOwner: referenceIsPartOwner,
609-
isAugmentation: isAugmentation,
610606
isPatch: isPatch,
611607
mayImplementRestrictedTypes: target.backendTarget.mayDefineRestrictedType(
612608
originImportUri,
@@ -694,7 +690,6 @@ class SourceLoader extends Loader implements ProblemReportingHelper {
694690
SourceCompilationUnit? origin,
695691
IndexedLibrary? referencesFromIndex,
696692
bool? referenceIsPartOwner,
697-
bool isAugmentation = false,
698693
bool isPatch = false,
699694
}) {
700695
CompilationUnit libraryBuilder = _read(
@@ -704,7 +699,6 @@ class SourceLoader extends Loader implements ProblemReportingHelper {
704699
origin: origin,
705700
referencesFromIndex: referencesFromIndex,
706701
referenceIsPartOwner: referenceIsPartOwner,
707-
isAugmentation: isAugmentation,
708702
isPatch: isPatch,
709703
addAsRoot: false,
710704
);
@@ -806,7 +800,6 @@ class SourceLoader extends Loader implements ProblemReportingHelper {
806800
fileUri: fileUri,
807801
referencesFromIndex: referencesFromIndex,
808802
addAsRoot: true,
809-
isAugmentation: false,
810803
isPatch: false,
811804
);
812805
// TODO(johnniwinther): Avoid using the first library, if present, as the
@@ -869,7 +862,6 @@ class SourceLoader extends Loader implements ProblemReportingHelper {
869862
SourceCompilationUnit? origin,
870863
required IndexedLibrary? referencesFromIndex,
871864
bool? referenceIsPartOwner,
872-
required bool isAugmentation,
873865
required bool isPatch,
874866
required bool addAsRoot,
875867
}) {
@@ -886,7 +878,6 @@ class SourceLoader extends Loader implements ProblemReportingHelper {
886878
origin: origin,
887879
referencesFromIndex: referencesFromIndex,
888880
referenceIsPartOwner: referenceIsPartOwner,
889-
isAugmentation: isAugmentation,
890881
isPatch: isPatch,
891882
addAsRoot: addAsRoot,
892883
);
@@ -1191,7 +1182,11 @@ severity: $severity
11911182
compilationUnit.importUri,
11921183
compilationUnit.packageLanguageVersion.version,
11931184
),
1194-
forAugmentationLibrary: compilationUnit.forAugmentationLibrary,
1185+
forAugmentationLibrary: target.isExperimentEnabledInLibraryByVersion(
1186+
ExperimentalFlag.augmentations,
1187+
compilationUnit.importUri,
1188+
compilationUnit.packageLanguageVersion.version,
1189+
),
11951190
),
11961191
languageVersionChanged: (Scanner scanner, LanguageVersionToken version) {
11971192
if (!suppressLexicalErrors) {
@@ -1204,6 +1199,8 @@ severity: $severity
12041199
scanner.configuration = new ScannerConfiguration(
12051200
enableTripleShift:
12061201
compilationUnit.libraryFeatures.tripleShift.isEnabled,
1202+
forAugmentationLibrary:
1203+
compilationUnit.libraryFeatures.augmentations.isEnabled,
12071204
);
12081205
},
12091206
allowLazyStrings: allowLazyStrings,

pkg/front_end/test/generator_to_string_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ Future<void> main() async {
108108
),
109109
originImportUri: uri,
110110
indexedLibrary: null,
111-
forAugmentationLibrary: false,
112111
augmentationRoot: null,
113112
resolveInLibrary: null,
114113
referenceIsPartOwner: null,

pkg/front_end/tool/dart_doctest_impl.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,6 @@ class DocTestIncrementalCompiler extends IncrementalCompiler {
11191119
loader: loader,
11201120
resolveInLibrary: libraryBuilder,
11211121
conditionalImportSupported: true,
1122-
forAugmentationLibrary: false,
11231122
isAugmenting: false,
11241123
forPatchLibrary: false,
11251124
referenceIsPartOwner: null,
@@ -1220,7 +1219,6 @@ class DocTestSourceLoader extends SourceLoader {
12201219
SourceCompilationUnit? origin,
12211220
IndexedLibrary? referencesFromIndex,
12221221
bool? referenceIsPartOwner,
1223-
bool isAugmentation = false,
12241222
bool isPatch = false,
12251223
required bool mayImplementRestrictedTypes,
12261224
}) {
@@ -1244,7 +1242,6 @@ class DocTestSourceLoader extends SourceLoader {
12441242
origin: origin,
12451243
referencesFromIndex: referencesFromIndex,
12461244
referenceIsPartOwner: referenceIsPartOwner,
1247-
isAugmentation: isAugmentation,
12481245
isPatch: isPatch,
12491246
mayImplementRestrictedTypes: mayImplementRestrictedTypes,
12501247
);

0 commit comments

Comments
 (0)