-
Notifications
You must be signed in to change notification settings - Fork 108
Change Generator to run on LibraryElement #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Closes #224, closes #220, closes #223 This is a breaking behavior change that may be slightly harder to notice than usual, because the old method signature is still a valid override. - Delete annotations.dart and tests. Annotations are no longer instantiated using mirrors, the DartObject is used isntead. - Move iterating over Elements into GeneratorForAnnotation instead of builder.dart - Drop `sourceMember` from `GeneratedOutput` since an entire output relates to a library. - Update test Generator implementations to operate on a library and iterate over elements manually when necessary. Other cleanup: - Remove some unnecessary library statements
😢 I broke const-ness with this - doesn't work with package:json_serializable as is |
google/json_serializable.dart#17 shows what this would look like in package:json_serializable |
lib/src/generator.dart
Outdated
/// // Return a string representing the code to emit. | ||
/// } | ||
/// } | ||
/// ``` | ||
abstract class Generator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know, some docs here might be nice...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the most part the doc on generate
is the important part...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a short doc that points toward [generate]
.
Closes dart-lang/source_gen#224, closes dart-lang/source_gen#220, closes dart-lang/source_gen#223 This is a breaking behavior change that may be slightly harder to notice than usual, because the old method signature is still a valid override. - Delete annotations.dart and tests. Annotations are no longer instantiated using mirrors, the DartObject is used isntead. - Move iterating over Elements into GeneratorForAnnotation instead of builder.dart - Drop `sourceMember` from `GeneratedOutput` since an entire output relates to a library. - Update test Generator implementations to operate on a library and iterate over elements manually when necessary. Other cleanup: - Remove some unnecessary library statements
Closes dart-lang/source_gen#224, closes dart-lang/source_gen#220, closes dart-lang/source_gen#223 This is a breaking behavior change that may be slightly harder to notice than usual, because the old method signature is still a valid override. - Delete annotations.dart and tests. Annotations are no longer instantiated using mirrors, the DartObject is used isntead. - Move iterating over Elements into GeneratorForAnnotation instead of builder.dart - Drop `sourceMember` from `GeneratedOutput` since an entire output relates to a library. - Update test Generator implementations to operate on a library and iterate over elements manually when necessary. Other cleanup: - Remove some unnecessary library statements
Closes #224, closes #220, closes #223
This is a breaking behavior change that may be slightly harder to notice
than usual, because the old method signature is still a valid override.
instantiated using mirrors, the DartObject is used isntead.
builder.dart
sourceMember
fromGeneratedOutput
since an entire outputrelates to a library.
iterate over elements manually when necessary.
Other cleanup: