Skip to content

Expression Compiler can't pass enough information for late local variables using DartScope.definitions #55918

Open
@nshahan

Description

@nshahan

The variables in scope are defined by a name and a type in the DartScope.definitions map. There isn't a mechanism to convey the CFE lowering for late locals where they have been turned into multiple locals:

  • backing store variable
  • get method
  • set method
  • isSet local variable (optionally when the type is nullable)

Ideally we need to provide some kind of information packet that says all of these values are tied to the same orignal source definition of a late local variable so references to it when evaluating an expression can be transformed to match the orignal lowering.

Temporarily I am going to expose the backing store which gets us most of the way there in terms of functionality, but has some odd side effects in some cases if you try to evaluate an expression using the late variable before it has been initialized with a value.

cc @johnniwinther @jensjoha @CoderDake

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.cfe-expression-compilationIssues related to expression compilation in the CFEweb-dev-compilerweb-evalevaluation support on the web

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions