Skip to content

[ffigen] Dart API: Change Struct.imported and friends to a callback #2595

@dcharkes

Description

@dcharkes
final class Structs extends Declarations {
  /// Structs imported from other Dart files.
  final List<ImportedType> imported;

We should change these imported fields to callbacks:

final class Structs extends Declarations {
  /// Structs imported from other Dart files.
  final ImportedType? Function(Declaration) imported;

This will enable:

  1. using Declaration.usr which means we can merge this.importedTypesByUsr = const <String, ImportedType>{} into this. ([ffigen] Dart API: Remove FfiGenerator.importedTypesByUsr #2596)
  2. match imports programmatically (instead of spelling out all ImportedTypes up front)

Context:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions