-
Notifications
You must be signed in to change notification settings - Fork 146
refactors: turn RenderBlockContent's per-case data into separate structs #358
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
refactors: turn RenderBlockContent's per-case data into separate structs #358
Conversation
@swift-ci Please test |
After some discussion offline, i'm going to scrap this branch and try something else. The kinds of changes proposed in this forums thread would still create breaking changes after this refactor, so we'll need to create a different architecture for |
I tinkered around with an alternate design (turning |
@swift-ci Please test |
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.
Looks really good! I think this is going to be really nice moving forward. All my feedback is non-blocking.
return blocks.rawIndexableTextContent(references: references) | ||
case let .orderedList(items): | ||
return items.map { | ||
case let .aside(a): |
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.
Nit: We don't have a lot of single-letter variable names in the codebase thus far. I think it probably fits in a little better to spell out the name of these types instead? (Throughout this PR)
case let .aside(a): | |
case let .aside(aside): |
// Warning: If you add a new case to this enum, make sure to handle it in the Codable | ||
// conformance at the bottom of this file, and in the `rawIndexableTextContent` method in | ||
// RenderBlockContent+TextIndexing.swift! |
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.
Hm I hadn't considered this. I guess ideally we wouldn't want to mark the the _nonfrozenEnum_useDefaultCase
case as deprecated internally and only extenrally so that we can still switch on it within the library and make sure SwiftDocC itself is covering all of bases.
What do you think of the trade-off here? Should we consider not deprecating it so we can switch over it internally? Then we would move the deprecation message into a documentation comment instead.
@swift-ci please test |
Bug/issue #, if applicable: rdar://97382349
Summary
This PR is a collection of refactors to RenderBlockContent that change any associated data in its enum cases to a separate struct. Without this change, any new data being added to these cases would become a source-breaking change to anything that used Swift-DocC as a library. As several of these are in the pipeline (swiftlang/swift-cmark#46, #53, etc), i wanted to introduce One Big Breaking Change ahead of time, so that any further changes are much easier to adopt.
Dependencies
None
Testing
This should not affect the behavior of Swift-DocC. Any testing should ensure that behavior remains the same.
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded