Skip to content

Swift: show conversions in PrintAst#10233

Merged
redsun82 merged 8 commits intomainfrom
redsun82/swift-conversions-in-print-ast
Sep 2, 2022
Merged

Swift: show conversions in PrintAst#10233
redsun82 merged 8 commits intomainfrom
redsun82/swift-conversions-in-print-ast

Conversation

@redsun82
Copy link
Contributor

@redsun82 redsun82 commented Aug 31, 2022

While the uncoverted node is still shown as a direct child, its conversions are listed in a new conversions virtual child.

Moreover, VarDecl (including ParamDecl) instance show their type as a property, and so do AbstractFunctionDecl.

This also showcases the customizability of the PrintAst infrastructure resting on generated code.

@redsun82 redsun82 requested a review from MathiasVP August 31, 2022 05:04
@redsun82 redsun82 requested a review from a team as a code owner August 31, 2022 05:04
@github-actions github-actions bot added the Swift label Aug 31, 2022
@redsun82 redsun82 marked this pull request as draft August 31, 2022 06:30
Base automatically changed from redsun82/swift-generate-printast to main August 31, 2022 08:26
This also showcases the customizability of the `PrintAst` infrastructure
resting on generated code.
@redsun82 redsun82 force-pushed the redsun82/swift-conversions-in-print-ast branch from 6e3ee80 to aa54e4b Compare August 31, 2022 09:31
@redsun82 redsun82 marked this pull request as ready for review August 31, 2022 09:32
@redsun82 redsun82 force-pushed the redsun82/swift-conversions-in-print-ast branch from 4046aa7 to 30049f6 Compare August 31, 2022 09:38
Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code LGTM, but I'm wondering if this is how we want the conversions to be laid out in the viewer.

Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines +10 to +15
Expr getConversion(int n) {
n = 0 and result = this.getConversion()
or
result = this.getConversion(n - 1).getConversion()
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this predicate is unused now, but maybe it'll be a useful thing to have in the future. If so, we should maybe add a Expr.getAConversion() predicate as well in the future.

@redsun82 redsun82 merged commit 48761b8 into main Sep 2, 2022
@redsun82 redsun82 deleted the redsun82/swift-conversions-in-print-ast branch September 2, 2022 14:13
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.

3 participants