Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 1697706

Browse files
author
Dart CI
committed
Version 2.16.0-134.0.dev
Merge commit '2edc9f4ea870b9a960abbe1a409eefa943fb65e9' into 'dev'
2 parents a04fa8e + 2edc9f4 commit 1697706

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -957,15 +957,14 @@ class ElementBuilder extends ThrowingAstVisitor<void> {
957957
element.fields = holder.properties.whereType<FieldElement>().toList();
958958
element.methods = holder.methods;
959959

960-
var constructors = holder.constructors;
961-
if (constructors.isEmpty) {
962-
var containerRef = element.reference!.getChild('@constructor');
963-
constructors = [
964-
ConstructorElementImpl('', -1)
965-
..isSynthetic = true
966-
..reference = containerRef.getChild(''),
967-
];
960+
if (holder.constructors.isEmpty) {
961+
holder.addConstructor(
962+
'',
963+
ConstructorElementImpl('', -1)..isSynthetic = true,
964+
);
968965
}
966+
967+
var constructors = holder.constructors;
969968
element.constructors = constructors;
970969

971970
// We have all fields and constructors.

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,19 @@ class _ElementWriter {
355355
void _writeConstructorElement(ConstructorElement e) {
356356
e as ConstructorElementImpl;
357357

358+
// Check that the reference exists, and filled with the element.
359+
var reference = e.reference;
360+
if (reference == null) {
361+
fail('Every constructor must have a reference.');
362+
} else {
363+
var classReference = reference.parent!.parent!;
364+
// We need this `if` for duplicate declarations.
365+
// The reference might be filled by another declaration.
366+
if (identical(classReference.element, e.enclosingElement)) {
367+
expect(reference.element, same(e));
368+
}
369+
}
370+
358371
_writeIndentedLine(() {
359372
_writeIf(e.isSynthetic, 'synthetic ');
360373
_writeIf(e.isExternal, 'external ');

tools/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ CHANNEL dev
2727
MAJOR 2
2828
MINOR 16
2929
PATCH 0
30-
PRERELEASE 133
30+
PRERELEASE 134
3131
PRERELEASE_PATCH 0

0 commit comments

Comments
 (0)