Skip to content

[DDC] Add capability to detect whether an object is a library for custom formatting #56967

@srujzs

Description

@srujzs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-dev-compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions