Skip to content

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

Merged
merged 3 commits into from
Jul 21, 2017

Conversation

natebosch
Copy link
Member

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

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
@natebosch
Copy link
Member Author

😢 I broke const-ness with this - doesn't work with package:json_serializable as is

@natebosch
Copy link
Member Author

google/json_serializable.dart#17 shows what this would look like in package:json_serializable

/// // Return a string representing the code to emit.
/// }
/// }
/// ```
abstract class Generator {
Copy link
Member

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...

Copy link
Member Author

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...

Copy link
Member Author

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].

@natebosch natebosch merged commit c4f5004 into master Jul 21, 2017
@natebosch natebosch deleted the natebosch_generate-by-library branch July 21, 2017 16:36
mosuem pushed a commit to dart-lang/build that referenced this pull request Dec 10, 2024
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
mosuem pushed a commit to dart-lang/build that referenced this pull request Dec 10, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove ability to instantiate annotations Find a solution for single-add situations like utility methods Add GeneratorForLibrary
3 participants