Skip to content

[record_use] Implementation: JSON: Unify Static calls and non-const constructor calls? #3168

@dcharkes

Description

@dcharkes

Currently we record instances as:

  • const instance
  • instance creation (constructor call)
  • constructor tearoff

And static calls as:

  • static call with arguments
  • tearoff

The last two, ways of recording const instances are basically the same as the static call recording.

After #3157, we would then probably drop the class itself from the constructor references and only point to the constructor definition.

Instead of nesting the constructor calls under the class definition in a map, we then need a separate data structure that relates definitions in the JSON.

  • E.g. for this class definition index, these are all its constructor definition indexes. (Maybe we actually don't because you can construct from a constructor Definition its class definition by dropping the constructor name.)
  • If we ever add support for subtyping, we would need to add some similar data structure relating definitions to add the subtype relationship, so that we can find all constructors and all types in the whole hierarchy that contribute const instances and non-const constructor calls.

From a Dart API point of view we'd probably want to keep these separate. We don't want users to start looking at constructor calls and ignore const instances, and the other way around.

(So just like #3157, we have an argument to make the underlying data model different from the API our users use.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions