Skip to content

[CP] Add ExtensionTypeRepresentationFieldInitializer.replaceChild #55194

Description

@chloestefantsova

Commit(s) to merge

ef6d68c

Target

stable

Prepared changelist for beta/stable

https://dart-review.googlesource.com/c/sdk/+/357600

Issue Description

Invocations of redirecting factories weren't resolved to their final targets in initializers of extension type constructors. The issue affects the web platforms, but not the VM. The VM performs the resolution of redirecting factory targets via a different mechanism. The compiler on the web platforms crashes when it tries to compile a file containing an extension type declaration with an extension type constructor that has an invocation of a redirecting factory in its initializer.

What is the fix

The bug occurs due to the method replaceChild being empty in the internal AST node representing the initializer of an extension type constructor. The replaceChild method is used to substitute the invocation of the immediate redirecting factory target with the invocation of the final target. The CL with the fix gives a meaningful implementation of replaceChild to that internal AST node.

Why cherry-pick

The issue affects every program on web platforms that contains an extension type declaration where the extension type constructor invokes a redirecting factory in its initializer. Such programs make the compiler on the platforms crash.

Risk

low

Issue link(s)

#55135

Extra Info

No response

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions