Skip to content

Commit c906c3a

Browse files
jensjohaCommit Queue
authored and
Commit Queue
committed
[CFE/kernel] Fix relink bug with ExtensionTypeDeclaration
Over the weekend the flutter-frontend bot started failing. This was caused by an update on the flutter side, where a dependency started using extension types, and revealed a bug with relinking on our side. This CL fixes the bug which should make the bot succeed again (as well as, I think, fix a potential leak/failure if rejecting an advanced invalidated incremental compilation. I will add tests in an upcoming CL. Change-Id: I1e73314b5ce5fe70819f921f9b176c7286b31f8a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350801 Reviewed-by: Chloe Stefantsova <[email protected]> Commit-Queue: Jens Johansen <[email protected]>
1 parent da51253 commit c906c3a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

pkg/kernel/lib/ast.dart

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ class Library extends NamedNode
574574
for (int i = 0; i < extensionTypeDeclarations.length; ++i) {
575575
ExtensionTypeDeclaration extensionTypeDeclaration =
576576
extensionTypeDeclarations[i];
577-
extensionTypeDeclaration._relinkNode();
577+
extensionTypeDeclaration.relink();
578578
}
579579
}
580580

@@ -1909,6 +1909,21 @@ class ExtensionTypeDeclaration extends NamedNode implements TypeDeclaration {
19091909
_procedures = procedures;
19101910
}
19111911

1912+
/// This is an advanced feature. Use of this method should be coordinated
1913+
/// with the kernel team.
1914+
///
1915+
/// See [Component.relink] for a comprehensive description.
1916+
///
1917+
/// Makes sure all references in named nodes in this extension type
1918+
/// declaration points to said named node.
1919+
void relink() {
1920+
this.reference.node = this;
1921+
for (int i = 0; i < procedures.length; ++i) {
1922+
Procedure member = procedures[i];
1923+
member._relinkNode();
1924+
}
1925+
}
1926+
19121927
@override
19131928
R accept<R>(TreeVisitor<R> v) => v.visitExtensionTypeDeclaration(this);
19141929

0 commit comments

Comments
 (0)