Add support for definitions implementing other definitions (#121)

Towards https://github.com/dart-lang/macros/issues/103

Adds an `implements` list to `Definition.clazz`, which:

- Replaces the default `implements Object` and instead lists all the implemented types (which transitively gives `Object`).
- Adds all inherited properties and associated code to the constructors and schemas
- Does not re-generate getters, these are inherited via `Implements`

I also added a base type `Declaration` because it is both useful and also serves as an example usage.

I think one good follow-up would be to add `is<Type>` and `as<Type>` getters to anything which is implemented by another type, for each of the types which implement it. We at least need some mechanism for down casting extension types to their known subtypes. One tricky part with that though is ideally we don't want to inherit those methods in the subtypes, because they won't all make sense?
4 files changed
tree: 83313b9fe5b9f57c6a61daf8413df475d74f940b
  1. .github/
  2. goldens/
  3. pkgs/
  4. schemas/
  5. tool/
  6. .gitattributes
  7. .gitignore
  8. CONTRIBUTING.md
  9. LICENSE
  10. mono_repo.yaml
  11. pubspec.yaml
  12. README.md
README.md

Overview

This repository is home to various macro related Dart packages.

Packages

PackageDescriptionVersion
_analyzer_macrosMacro support for the analyzer.
_cfe_macrosMacro support for the CFE.
_macro_builderBuilds macros.
_macro_clientConnects user macro code to a macro host.
_macro_hostHosts macros.
_macro_runnerRuns macros.
_macro_serverServes a macro_service.
_test_macrosSome test macros.
dart_modelData model for information about Dart code, queries about Dart code and augmentations to Dart code. Serializable with a versioned JSON schema for use by macros, generators and other tools.pub package
macroFor implementing a macro.pub package
macro_serviceMacro communication with the macro host.pub package
generate_dart_model

Publishing automation

For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

For additional information about contributing, see our contributing page.