Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ddc] Super calls are broken in a library after it has been hot reloaded #59628

Closed
nshahan opened this issue Nov 27, 2024 · 0 comments
Closed
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dev-compiler

Comments

@nshahan
Copy link
Contributor

nshahan commented Nov 27, 2024

Background:
The JavaScript super keyword binds to the class where it was defined in the source code.

  • If that classes prototype chain is updated to point to a different superclass, the super keyword works as expected and dispatches along the new prototype chain. This is good!
  • If the member containing a super call is copied into a different class, the super call is still bound to the prototype chain of the class where it was originally defined. This is bad!

The current hot reload behavior is to copy members from a new temporary class where they are defined, into the existing class from the previous generation during the initialization phase of a library. Later in the link phase the class hierarchies are connected by updating the prototype chains. This handling is causing super calls to be broken in a library that is hot reloaded, even if the diff is completely unrelated to the super call or even the class that contains it.

@nshahan nshahan added web-dev-compiler area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. labels Nov 27, 2024
copybara-service bot pushed a commit that referenced this issue Nov 28, 2024
Regression test for broken super calls after a hot reload.

Issue: #59628
Change-Id: I799cac6babb45f0a8f7d2dd63fdfbaea72dba9b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398041
Reviewed-by: Nate Biggs <[email protected]>
Commit-Queue: Nicholas Shahan <[email protected]>
Reviewed-by: Mark Zhou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dev-compiler
Projects
None yet
Development

No branches or pull requests

1 participant