[SourceKit] Share common object printer code #3163
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's in this pull request?
I thought it would make sense to open a new PR for a subset of the changes being discussed in #3026.
This is my attempt at implementing @akyrtzi's suggestion here. I didn't see how it would be possible to do it exactly as proposed, since the
SKDObjectPrinterBase
class needs access to thevisit
method to dispatch based on the type of arbitrary elements in a dictionary or array. I used a slightly different structure here which seemed to make sense, however the previous design of the classesSKDObjectVisitor
andSKDObjectPrinter
classes seemed confusing to me to begin with, so it's quite possible that some original design goals haven't been preserved with my changes.I also noticed that the code duplication being discussed in relation to the InProc additions in #3026 already existed with the XPC
SKDObjectPrinter
and theVariantPrinter
classes which I am addressing here.Related bug number: (SR-1639)
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.
This is an attempt to clean up code duplication around printing SourceKit
request and response objects.