Skip to content

Commit 2c3ff3f

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Remove augmentation properties/accessors relinking information.
We now write and read library fragments in the correct order, so declarations are always read before augmentations. Change-Id: I5a35cf8d963c3a5010344361289d3be4dc5b7f11 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392620 Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent a40403e commit 2c3ff3f

File tree

3 files changed

+1
-65
lines changed

3 files changed

+1
-65
lines changed

pkg/analyzer/lib/src/dart/analysis/driver.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ import 'package:meta/meta.dart';
9898
// TODO(scheglov): Clean up the list of implicitly analyzed files.
9999
class AnalysisDriver {
100100
/// The version of data format, should be incremented on every format change.
101-
static const int DATA_VERSION = 408;
101+
static const int DATA_VERSION = 409;
102102

103103
/// The number of exception contexts allowed to write. Once this field is
104104
/// zero, we stop writing any new exception contexts in this process.

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,6 @@ class LibraryReader {
683683
);
684684

685685
var resolutionOffset = _baseResolutionOffset + _reader.readUInt30();
686-
var accessorAugmentationsOffset = _reader.readUInt30();
687-
688686
libraryElement.linkedData = LibraryElementLinkedData(
689687
reference: _reference,
690688
libraryReader: this,
@@ -698,8 +696,6 @@ class LibraryReader {
698696
_elementFactory, _unitsInformativeBytes, _deserializedDataStore)
699697
.applyTo(libraryElement);
700698

701-
_readPropertyAccessorAugmentations(accessorAugmentationsOffset);
702-
703699
return libraryElement;
704700
}
705701

@@ -1528,29 +1524,6 @@ class LibraryReader {
15281524
);
15291525
}
15301526

1531-
/// This method is invoked when all units of the library are read, the
1532-
/// defining unit, and all its augmentations. So, we have all elements
1533-
/// created (excluding class members, that are delayed).
1534-
///
1535-
/// We can read now augmentation back and forth pointers, for accessors and
1536-
/// properties.
1537-
void _readPropertyAccessorAugmentations(int offset) {
1538-
var reader = ResolutionReader(
1539-
_elementFactory,
1540-
_referenceReader,
1541-
_reader.fork(_baseResolutionOffset + offset),
1542-
);
1543-
var accessors = reader.readElementList<PropertyAccessorElementImpl>();
1544-
for (var element in accessors) {
1545-
element.linkedData?.read(element);
1546-
}
1547-
1548-
var properties = reader.readElementList<PropertyInducingElementImpl>();
1549-
for (var element in properties) {
1550-
element.linkedData?.read(element);
1551-
}
1552-
}
1553-
15541527
PropertyAccessorElementImpl _readPropertyAccessorElement(
15551528
CompilationUnitElementImpl unitElement,
15561529
ElementImpl classElement,

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

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,6 @@ class BundleWriter {
5454
references: _references,
5555
);
5656

57-
/// [_writePropertyAccessorElement] adds augmentations here, so that after
58-
/// reading the library we can read them, and while doing this, update
59-
/// `getter` and `setter` of augmented variables.
60-
List<PropertyAccessorElementImpl> _accessorAugmentations = [];
61-
62-
/// [_writeFieldElement] adds augmentations here, so that after
63-
/// reading the library we can read them, and while doing this, update
64-
/// getters and setter to point at this property augmentation, and set
65-
/// `getter` and `setter` of the augmentation.
66-
List<PropertyInducingElementImpl> _propertyAugmentations = [];
67-
6857
final StringIndexer _stringIndexer = StringIndexer();
6958

7059
final List<_Library> _libraries = [];
@@ -107,8 +96,6 @@ class BundleWriter {
10796

10897
void writeLibraryElement(LibraryElementImpl libraryElement) {
10998
var libraryOffset = _sink.offset;
110-
_accessorAugmentations = [];
111-
_propertyAugmentations = [];
11299

113100
// Write non-resolution data for the library.
114101
_sink._writeStringReference(libraryElement.name);
@@ -130,8 +117,6 @@ class BundleWriter {
130117
_writeFieldNameNonPromotabilityInfo(
131118
libraryElement.fieldNameNonPromotabilityInfo);
132119

133-
_writePropertyAccessorAugmentations();
134-
135120
var lastUnit = libraryElement.units.lastOrNull;
136121
var macroGenerated = lastUnit?.macroGenerated;
137122

@@ -423,11 +408,6 @@ class BundleWriter {
423408
_resolutionSink._writeAnnotationList(element.metadata);
424409
_resolutionSink.writeMacroDiagnostics(element.macroDiagnostics);
425410
_resolutionSink.writeType(element.type);
426-
427-
if (element.isAugmentation) {
428-
_propertyAugmentations.add(element);
429-
}
430-
431411
_resolutionSink._writeOptionalNode(element.constantInitializer);
432412
}
433413

@@ -647,15 +627,6 @@ class BundleWriter {
647627
}
648628
}
649629

650-
/// Write information to update `getter` and `setter` properties of
651-
/// augmented variables to use the corresponding augmentations.
652-
void _writePropertyAccessorAugmentations() {
653-
var offset = _resolutionSink.offset;
654-
_resolutionSink._writeElementList(_accessorAugmentations);
655-
_resolutionSink._writeElementList(_propertyAugmentations);
656-
_sink.writeUInt30(offset);
657-
}
658-
659630
void _writePropertyAccessorElement(PropertyAccessorElementImpl element) {
660631
_sink.writeUInt30(_resolutionSink.offset);
661632
_writeReference(element);
@@ -671,10 +642,6 @@ class BundleWriter {
671642
if (!element.isAugmentation) {
672643
_writeReference(element.variable2!);
673644
}
674-
675-
if (element.isAugmentation) {
676-
_accessorAugmentations.add(element);
677-
}
678645
}
679646

680647
/// Write the reference of a non-local element.
@@ -702,10 +669,6 @@ class BundleWriter {
702669
_resolutionSink.writeMacroDiagnostics(element.macroDiagnostics);
703670
_resolutionSink.writeType(element.type);
704671

705-
if (element.isAugmentation) {
706-
_propertyAugmentations.add(element);
707-
}
708-
709672
_resolutionSink._writeOptionalNode(element.constantInitializer);
710673
}
711674

0 commit comments

Comments
 (0)