Skip to content

Commit 33b0f8f

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Store name2 in PrefixFragmentImpl.
Change-Id: Idf841cb0c1c7f8bf576c9bd2ced6c69fd1cc495d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390625 Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent c92cb89 commit 33b0f8f

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9151,6 +9151,9 @@ class PrefixFragmentImpl implements PrefixFragment {
91519151
@override
91529152
int nameOffset;
91539153

9154+
@override
9155+
FragmentNameImpl name2;
9156+
91549157
@override
91559158
final bool isDeferred;
91569159

@@ -9167,6 +9170,7 @@ class PrefixFragmentImpl implements PrefixFragment {
91679170
required this.enclosingFragment,
91689171
required this.name,
91699172
required this.nameOffset,
9173+
required this.name2,
91709174
required this.isDeferred,
91719175
});
91729176

@@ -9175,14 +9179,6 @@ class PrefixFragmentImpl implements PrefixFragment {
91759179

91769180
@override
91779181
CompilationUnitElementImpl get libraryFragment => enclosingFragment;
9178-
9179-
@override
9180-
FragmentName? get name2 {
9181-
return FragmentNameImpl(
9182-
name: name,
9183-
nameOffset: nameOffset,
9184-
);
9185-
}
91869182
}
91879183

91889184
abstract class PromotableElementImpl2 extends VariableElementImpl2

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,7 @@ class LibraryReader {
13251325
enclosingFragment: libraryFragment,
13261326
name: name,
13271327
nameOffset: -1,
1328+
name2: FragmentNameImpl(name: name, nameOffset: -1),
13281329
isDeferred: isDeferred,
13291330
);
13301331

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,10 @@ class InformativeDataApplier {
665665
}
666666
}
667667

668-
element.prefix2?.nameOffset = info.prefixOffset;
668+
if (element.prefix2 case var prefixFragment?) {
669+
prefixFragment.nameOffset = info.prefixOffset;
670+
prefixFragment.name2.nameOffset = info.prefixOffset;
671+
}
669672
_applyToCombinators(element.combinators, info.combinators);
670673
},
671674
);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,10 @@ class LibraryBuilder with MacroApplicationsContainer {
12031203
var fragment = PrefixFragmentImpl(
12041204
enclosingFragment: libraryFragment,
12051205
name: name,
1206+
name2: FragmentNameImpl(
1207+
name: name,
1208+
nameOffset: nameOffset,
1209+
),
12061210
nameOffset: nameOffset,
12071211
isDeferred: isDeferred,
12081212
);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,8 @@ class _Element2Writer extends _AbstractElementWriter {
15791579
_sink.write('fragments: ');
15801580
_sink.write(e.fragments.map((f) {
15811581
expect(f.element, same(e));
1582-
return '@${f.nameOffset}';
1582+
expect(f.name2.name, e.name);
1583+
return '@${f.name2.nameOffset}';
15831584
}).join(' '));
15841585
});
15851586
});

0 commit comments

Comments
 (0)