dart-lang / macros

A Dart mono-repo for macro development.
BSD 3-Clause "New" or "Revised" License
20 stars 2 forks source link

Add minimal model schema and generation of extension types based on it. #3

Closed davidmorgan closed 1 month ago

davidmorgan commented 1 month ago

Add a schema and a generator that generates extension types based on it.

Obviously we don't have to check in the generated code but it seems useful for now that we review it.

No particular clear ideas on the best way to lay this out, e.g. the top level "schema" folder, the generator under "tool". Happy to hear any suggestions.

No test coverage for the generator yet but we get exactly one golden file test, the output, for free :) happy to add anything you think is useful at this point.

Next steps:

1) a way to combine manually written code with the generated code, to add docs and helper methods. 2) a way to construct the extension types that is compatible with representation as a byte buffer, i.e. the underlying collections need to be swapped for special purpose ones.

davidmorgan commented 1 month ago

Added analysis options, filed https://github.com/dart-lang/sdk/issues/56047 because it doesn't work in VSCode (for me) :)