Skip to content

Commit 895d0b1

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Write LibraryFragment.enclosingFragment, fix it.
Change-Id: If25d812e3e0bb279bb6baabb126fe1c0339283d2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394007 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 8b3c5aa commit 895d0b1

16 files changed

+459
-4
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,9 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
866866
}
867867

868868
@override
869-
LibraryFragment? get enclosingFragment => null;
869+
CompilationUnitElementImpl? get enclosingFragment {
870+
return enclosingElement3;
871+
}
870872

871873
@override
872874
CompilationUnitElementImpl get enclosingUnit {

pkg/analyzer/test/src/summary/element_text.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -763,9 +763,9 @@ class _Element2Writer extends _AbstractElementWriter {
763763
_sink.writelnWithIndent(name);
764764
_sink.withIndent(() {
765765
for (var element in filtered) {
766-
expect(element.enclosingFragment, expectedEnclosingFragment);
767-
// TODO(brianwilkerson): Explicitly check the next/previous fragment
768-
// attributes and stop writing them to the dump.
766+
if (expectedEnclosingFragment != null) {
767+
expect(element.enclosingFragment, expectedEnclosingFragment);
768+
}
769769
write(element);
770770
}
771771
});
@@ -1150,6 +1150,7 @@ class _Element2Writer extends _AbstractElementWriter {
11501150

11511151
_sink.withIndent(() {
11521152
_writeElementReference('element', f.element);
1153+
_writeFragmentReference('enclosingFragment', f.enclosingFragment);
11531154
_writeFragmentReference('previousFragment', f.previousFragment);
11541155
_writeFragmentReference('nextFragment', f.nextFragment);
11551156

0 commit comments

Comments
 (0)