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] Add capability to detect whether an object is a library for custom formatting #56967

Open
srujzs opened this issue Oct 25, 2024 · 0 comments
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dev-compiler

Comments

@srujzs
Copy link
Contributor

srujzs commented Oct 25, 2024

Currently, our custom formatter in DDC formats libraries only within the context of a module. Specifically, given a module, we recognize it as a special object using getModuleName:

name: name, value: Library(name, value!), hideName: true));
. Then, we know to use the custom formatter for that module. Given that, the module formatter explicitly creates a Library object to format each library within that module:
if (dart.isJsInterop(object) && dart.getModuleName(object) == null) {
. This then means that libraries are every formatted when a user inspects a module. When a user inspects a library, it is treated as just a JS object because we cannot detect whether it's a library.

With the new module format, this becomes even more important as we no longer have modules, only libraries. Once we add this capability to detect libraries, _useNativeJSFormatter should be updated. Similarly, debugger_test.dart should be updated to directly pass libraries instead of wrapping them in Librarys. See https://dart-review.googlesource.com/c/sdk/+/389589.

@srujzs srujzs added web-dev-compiler area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. labels Oct 25, 2024
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