Skip to content
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

Support augmentation-declared constructors and methods. #3712

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

srawlins
Copy link
Member

@srawlins srawlins commented Mar 9, 2024

The gist of this is to not just ask an Element for it's methods and for its constructors, but make sure to ask the augmented element, if there is one.

Work towards #3693

Again, we still cannot check in tests as we cannot depend on _fe_analyzer_shared or analyzer from the Dart SDK, or use the correct macros import. But with this code, we get the following features:

  • augmentation-declared constructor is shown in the sidebar; same for augmentation-declared method,
  • augmentation-declared constructor is shown in a class's page; same for augmentation-declared method,
  • augmentation-declared constructor has it's own page; can be linked to from a doc comment; is linked to from the class's page,
  • augmentation-declared method does not have it's own page yet; cannot be linked yet.

A few fixes are made additionally:

  • While working on this, I saw that a crash would mean that the AnalysisContextCollectionImpl was never disposed. So I tidied that all back into PackageBuilder. It can not be the PackageBuilder's caller's responsibility to dispose, because that amounts to have a dozen places in tests.
  • In the code that gathers inheritance info, we also need to make sure to grab an element's augmented declaration, if there is one.

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

The gist of this is to not just ask an Element for it's methods and for its
constructors, but make sure to ask the augmented element, if there is one.

A few fixes are made additionally:

* While working on this, I saw that a crash would mean that the
  AnalysisContextCollectionImpl was never `disposed`. So I tidied that all back
  into PackageBuilder. It can not be the PackageBuilder's caller's
  responsibility to dispose, because that amounts to have a dozen places in
  tests.
* In the code that gathers inheritance info, we also need to make sure to grab
  an element's augmented declaration, if there is one.
@srawlins srawlins requested a review from kallentu March 9, 2024 01:58
@srawlins srawlins merged commit 315f302 into dart-lang:main Mar 11, 2024
9 checks passed
@srawlins srawlins deleted the macros-elements branch March 11, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants