Skip to content

Commit 2e920a4

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Consistently use withoutLoadingResolution() in InformativeDataApplier.
Remove `xyz_unresolved` getters. Change-Id: Ia29481712b908751c90be9102271679324cdd147 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441421 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Paul Berry <[email protected]>
1 parent 061b883 commit 2e920a4

File tree

2 files changed

+66
-84
lines changed

2 files changed

+66
-84
lines changed

pkg/analyzer/lib/src/dart/element/element.dart

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2500,10 +2500,6 @@ abstract class ExecutableFragmentImpl extends _ExistingFragmentImpl
25002500
}
25012501
_parameters = parameters;
25022502
}
2503-
2504-
List<FormalParameterFragmentImpl> get parameters_unresolved {
2505-
return _parameters;
2506-
}
25072503
}
25082504

25092505
class ExtensionElementImpl extends InstanceElementImpl
@@ -6367,10 +6363,6 @@ class LibraryFragmentImpl extends _ExistingFragmentImpl
63676363
@override
63686364
List<LibraryExport> get libraryExports2 => libraryExports;
63696365

6370-
List<LibraryExportImpl> get libraryExports_unresolved {
6371-
return _libraryExports;
6372-
}
6373-
63746366
@override
63756367
LibraryFragment get libraryFragment => this;
63766368

@@ -6391,10 +6383,6 @@ class LibraryFragmentImpl extends _ExistingFragmentImpl
63916383
@override
63926384
List<LibraryImport> get libraryImports2 => libraryImports;
63936385

6394-
List<LibraryImportImpl> get libraryImports_unresolved {
6395-
return _libraryImports;
6396-
}
6397-
63986386
@override
63996387
List<MixinFragmentImpl> get mixins => _mixins;
64006388

@@ -9756,10 +9744,6 @@ class TypeAliasFragmentImpl extends _ExistingFragmentImpl
97569744
aliasedElement?.enclosingFragment = this;
97579745
}
97589746

9759-
FragmentImpl? get aliasedElement_unresolved {
9760-
return _aliasedElement;
9761-
}
9762-
97639747
@override
97649748
List<Fragment> get children => const [];
97659749

@@ -10154,10 +10138,6 @@ mixin TypeParameterizedFragmentMixin on FragmentImpl
1015410138
@override
1015510139
List<TypeParameterFragmentImpl> get typeParameters2 => typeParameters;
1015610140

10157-
List<TypeParameterFragmentImpl> get typeParameters_unresolved {
10158-
return _typeParameters;
10159-
}
10160-
1016110141
void _ensureReadResolution();
1016210142
}
1016310143

pkg/analyzer/lib/src/summary2/informative_data.dart

Lines changed: 66 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ class InformativeDataApplier {
6969
unitElement.setCodeRange(unitInfo.codeOffset, unitInfo.codeLength);
7070
unitElement.lineInfo = LineInfo(unitInfo.lineStarts);
7171

72-
_applyToImports(unitElement.libraryImports_unresolved, unitInfo);
73-
_applyToExports(unitElement.libraryExports_unresolved, unitInfo);
72+
unitElement.withoutLoadingResolution(() {
73+
_applyToImports(unitElement.libraryImports, unitInfo);
74+
_applyToExports(unitElement.libraryExports, unitInfo);
75+
});
7476

7577
unitElement.deferConstantOffsets(unitInfo.libraryConstantOffsets, (
7678
applier,
@@ -169,12 +171,15 @@ class InformativeDataApplier {
169171
element.firstTokenOffset = info.firstTokenOffset;
170172
element.nameOffset = info.nameOffset2;
171173
element.documentationComment = info.documentationComment;
172-
_applyToFormalParameters(element.parameters_unresolved, info.parameters);
174+
175+
element.withoutLoadingResolution(() {
176+
_applyToFormalParameters(element.parameters, info.parameters);
177+
});
173178

174179
element.deferConstantOffsets(info.constantOffsets, (applier) {
175180
applier.applyToMetadata(element.metadata);
176181
applier.applyToTypeParameters(element.typeParameters);
177-
applier.applyToFormalParameters(element.parameters_unresolved);
182+
applier.applyToFormalParameters(element.parameters);
178183
});
179184
});
180185
}
@@ -187,10 +192,10 @@ class InformativeDataApplier {
187192
element.firstTokenOffset = info.firstTokenOffset;
188193
element.nameOffset = info.nameOffset2;
189194
element.documentationComment = info.documentationComment;
190-
_applyToTypeParameters(
191-
element.typeParameters_unresolved,
192-
info.typeParameters,
193-
);
195+
196+
element.withoutLoadingResolution(() {
197+
_applyToTypeParameters(element.typeParameters, info.typeParameters);
198+
});
194199

195200
element.deferConstantOffsets(info.constantOffsets, (applier) {
196201
applier.applyToMetadata(element.metadata);
@@ -216,10 +221,10 @@ class InformativeDataApplier {
216221
element.firstTokenOffset = info.firstTokenOffset;
217222
element.nameOffset = info.nameOffset2;
218223
element.documentationComment = info.documentationComment;
219-
_applyToTypeParameters(
220-
element.typeParameters_unresolved,
221-
info.typeParameters,
222-
);
224+
225+
element.withoutLoadingResolution(() {
226+
_applyToTypeParameters(element.typeParameters, info.typeParameters);
227+
});
223228

224229
element.deferConstantOffsets(info.constantOffsets, (applier) {
225230
applier.applyToMetadata(element.metadata);
@@ -260,7 +265,9 @@ class InformativeDataApplier {
260265
element.nameOffset = info.nameOffset2;
261266
element.documentationComment = info.documentationComment;
262267

263-
_applyToFormalParameters(element.parameters_unresolved, info.parameters);
268+
element.withoutLoadingResolution(() {
269+
_applyToFormalParameters(element.parameters, info.parameters);
270+
});
264271

265272
element.deferConstantOffsets(info.constantOffsets, (applier) {
266273
applier.applyToMetadata(element.metadata);
@@ -279,7 +286,6 @@ class InformativeDataApplier {
279286
element.nameOffset = info.nameOffset2;
280287
element.documentationComment = info.documentationComment;
281288

282-
// TODO(scheglov): use it everywhere
283289
element.withoutLoadingResolution(() {
284290
_applyToTypeParameters(element.typeParameters, info.typeParameters);
285291
_applyToConstructors(element.constructors, info.constructors);
@@ -310,10 +316,11 @@ class InformativeDataApplier {
310316
element.firstTokenOffset = info.firstTokenOffset;
311317
element.nameOffset = info.nameOffset2;
312318
element.documentationComment = info.documentationComment;
313-
_applyToTypeParameters(
314-
element.typeParameters_unresolved,
315-
info.typeParameters,
316-
);
319+
320+
element.withoutLoadingResolution(() {
321+
_applyToTypeParameters(element.typeParameters, info.typeParameters);
322+
});
323+
317324
_applyToFields(element.fields, info.fields);
318325
_applyToAccessors(element.getters, info.getters);
319326
_applyToAccessors(element.setters, info.setters);
@@ -333,10 +340,10 @@ class InformativeDataApplier {
333340
element.firstTokenOffset = info.firstTokenOffset;
334341
element.nameOffset = info.nameOffset2;
335342
element.documentationComment = info.documentationComment;
336-
_applyToTypeParameters(
337-
element.typeParameters_unresolved,
338-
info.typeParameters,
339-
);
343+
344+
element.withoutLoadingResolution(() {
345+
_applyToTypeParameters(element.typeParameters, info.typeParameters);
346+
});
340347

341348
var representationField = element.fields.first;
342349
var infoRep = info.representation;
@@ -360,14 +367,12 @@ class InformativeDataApplier {
360367
primaryConstructor.nameOffset = infoRep.constructorNameOffset2;
361368
primaryConstructor.nameEnd = infoRep.constructorNameEnd;
362369

363-
var primaryConstructorParameter =
364-
primaryConstructor.parameters_unresolved.first;
365-
primaryConstructorParameter.firstTokenOffset = infoRep.firstTokenOffset;
366-
primaryConstructorParameter.nameOffset = infoRep.fieldNameOffset2;
367-
primaryConstructorParameter.setCodeRange(
368-
infoRep.codeOffset,
369-
infoRep.codeLength,
370-
);
370+
primaryConstructor.withoutLoadingResolution(() {
371+
var representation = primaryConstructor.parameters.first;
372+
representation.firstTokenOffset = infoRep.firstTokenOffset;
373+
representation.nameOffset = infoRep.fieldNameOffset2;
374+
representation.setCodeRange(infoRep.codeOffset, infoRep.codeLength);
375+
});
371376

372377
var restFields = element.fields.skip(1).toList();
373378
_applyToFields(restFields, info.fields);
@@ -425,11 +430,11 @@ class InformativeDataApplier {
425430
element.firstTokenOffset = info.firstTokenOffset;
426431
element.nameOffset = info.nameOffset2;
427432
element.documentationComment = info.documentationComment;
428-
_applyToTypeParameters(
429-
element.typeParameters_unresolved,
430-
info.typeParameters,
431-
);
432-
_applyToFormalParameters(element.parameters_unresolved, info.parameters);
433+
434+
element.withoutLoadingResolution(() {
435+
_applyToTypeParameters(element.typeParameters, info.typeParameters);
436+
_applyToFormalParameters(element.parameters, info.parameters);
437+
});
433438

434439
element.deferConstantOffsets(info.constantOffsets, (applier) {
435440
applier.applyToMetadata(element.metadata);
@@ -446,14 +451,13 @@ class InformativeDataApplier {
446451
element.firstTokenOffset = info.firstTokenOffset;
447452
element.nameOffset = info.nameOffset2;
448453
element.documentationComment = info.documentationComment;
449-
_applyToTypeParameters(
450-
element.typeParameters_unresolved,
451-
info.typeParameters,
452-
);
453-
if (element.aliasedElement_unresolved
454-
case GenericFunctionTypeFragmentImpl aliased) {
455-
_applyToFormalParameters(aliased.parameters, info.parameters);
456-
}
454+
455+
element.withoutLoadingResolution(() {
456+
_applyToTypeParameters(element.typeParameters, info.typeParameters);
457+
if (element.aliasedElement case GenericFunctionTypeFragmentImpl aliased) {
458+
_applyToFormalParameters(aliased.parameters, info.parameters);
459+
}
460+
});
457461

458462
_setupApplyConstantOffsetsForTypeAlias(
459463
element,
@@ -470,21 +474,20 @@ class InformativeDataApplier {
470474
element.firstTokenOffset = info.firstTokenOffset;
471475
element.nameOffset = info.nameOffset2;
472476
element.documentationComment = info.documentationComment;
473-
_applyToTypeParameters(
474-
element.typeParameters_unresolved,
475-
info.typeParameters,
476-
);
477-
if (element.aliasedElement_unresolved
478-
case GenericFunctionTypeFragmentImpl aliased) {
479-
_applyToTypeParameters(
480-
aliased.typeParameters,
481-
info.aliasedTypeParameters,
482-
);
483-
_applyToFormalParameters(
484-
aliased.parameters,
485-
info.aliasedFormalParameters,
486-
);
487-
}
477+
478+
element.withoutLoadingResolution(() {
479+
_applyToTypeParameters(element.typeParameters, info.typeParameters);
480+
if (element.aliasedElement case GenericFunctionTypeFragmentImpl aliased) {
481+
_applyToTypeParameters(
482+
aliased.typeParameters,
483+
info.aliasedTypeParameters,
484+
);
485+
_applyToFormalParameters(
486+
aliased.parameters,
487+
info.aliasedFormalParameters,
488+
);
489+
}
490+
});
488491

489492
_setupApplyConstantOffsetsForTypeAlias(
490493
element,
@@ -524,11 +527,11 @@ class InformativeDataApplier {
524527
element.firstTokenOffset = info.firstTokenOffset;
525528
element.nameOffset = info.nameOffset2;
526529
element.documentationComment = info.documentationComment;
527-
_applyToTypeParameters(
528-
element.typeParameters_unresolved,
529-
info.typeParameters,
530-
);
531-
_applyToFormalParameters(element.parameters_unresolved, info.parameters);
530+
531+
element.withoutLoadingResolution(() {
532+
_applyToTypeParameters(element.typeParameters, info.typeParameters);
533+
_applyToFormalParameters(element.parameters, info.parameters);
534+
});
532535

533536
element.deferConstantOffsets(info.constantOffsets, (applier) {
534537
applier.applyToMetadata(element.metadata);
@@ -547,7 +550,6 @@ class InformativeDataApplier {
547550
element.nameOffset = info.nameOffset2;
548551
element.documentationComment = info.documentationComment;
549552

550-
// TODO(scheglov): use it everywhere
551553
element.withoutLoadingResolution(() {
552554
_applyToTypeParameters(element.typeParameters, info.typeParameters);
553555
_applyToConstructors(element.constructors, info.constructors);

0 commit comments

Comments
 (0)