Skip to content

Commit c324e0c

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Create synthetic constructors for ClassElementImpl, not for ClassFragmentImpl.
Change-Id: I56b84b03ab9afe889704273200a3240063d1df94 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442251 Reviewed-by: Samuel Rawlins <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 0bc13a8 commit c324e0c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,18 @@ class LibraryBuilder {
149149
}
150150

151151
void buildClassSyntheticConstructors() {
152-
for (var classFragment in element.topLevelElements) {
153-
if (classFragment is! ClassFragmentImpl) continue;
154-
if (classFragment.isMixinApplication) continue;
155-
if (classFragment.constructors.isNotEmpty) continue;
152+
for (var classElement in element.children) {
153+
if (classElement is! ClassElementImpl) continue;
154+
if (classElement.isMixinApplication) continue;
155+
if (classElement.constructors.isNotEmpty) continue;
156156

157157
var fragment = ConstructorFragmentImpl(
158158
name: 'new',
159159
firstTokenOffset: null,
160160
)..isSynthetic = true;
161-
fragment.typeName = classFragment.name;
161+
fragment.typeName = classElement.name;
162+
classElement.firstFragment.constructors = [fragment].toFixedList();
162163

163-
var classElement = classFragment.element;
164164
classElement.constructors = [
165165
ConstructorElementImpl(
166166
name: fragment.name,
@@ -170,8 +170,6 @@ class LibraryBuilder {
170170
firstFragment: fragment,
171171
),
172172
];
173-
174-
classFragment.constructors = [fragment].toFixedList();
175173
}
176174
}
177175

0 commit comments

Comments
 (0)