Skip to content

dartdevc: eliminate the foreignJS extra magic Β #46002

@sigmundch

Description

@sigmundch

DDC has special logic to emit code differently when in the context of JS foreign functions. This has worked in the past because DDC is fairly local and all uses of JS foreign functions were within the SDK.

This special logic is hard to follow: reading the runtime libraries is ambiguous and confusing. Also the assumptions are changing:

  • we are discussing the possiblity of implementing simple kernel inlining transformations, which will break the SDK-only assumption above
  • In recent explorations with optimizing js_util methods, we have added lowering to helper methods and even to JS foreign calls. This lowering broke assumptions made by DDC and started triggering issues. For example see https://dart-review.googlesource.com/c/sdk/+/199540

To eliminate all this special magic we should instead:

  • use helpers methods like typeRep<T> in the sdk libraries to remove the special magic.
  • eventually reduce the use of large string-interpolated inputs to JS, instead adopt a more frugal use of JS like dart2js does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-dev-compilerweb-technical-debt

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions