Skip to content

Improve modeling of Child in CodeGeneration #1914

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 2 commits into from
Jul 19, 2023

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jul 17, 2023

Two changes:

  • Make Child.varName a TokenSyntax
  • Change type of Child.documentation to Trivia
    • This also fixes a bug that caused multi-line documentation of children to be rendered incorrectly

@ahoppen ahoppen requested review from bnbarham and kimdv July 17, 2023 14:10
@ahoppen
Copy link
Member Author

ahoppen commented Jul 17, 2023

@swift-ci Please test

public let documentation: SwiftSyntax.Trivia

/// The first line of the child's documentation
public let documentationAbstract: String
Copy link
Contributor

Choose a reason for hiding this comment

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

I've been thinking if this also should be using a Trivia type but in the end a String type makes more sense. Changing it would mean that in methods like this: func generateInitializerDocComment() -> SwiftSyntax.Trivia we would have to use something like TriviaPiece.commentValue property proposed in #1890.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the problem is that we use this string for the parameter documentation of the node’s initializers. And for those, we don’t want it prefixed with ///

@ahoppen ahoppen force-pushed the ahoppen/child-improvements branch from f8cc5a2 to cc6fca0 Compare July 18, 2023 16:58
@ahoppen ahoppen force-pushed the ahoppen/child-improvements branch from cc6fca0 to 7b8e86b Compare July 18, 2023 17:02
@ahoppen
Copy link
Member Author

ahoppen commented Jul 18, 2023

@swift-ci Please test

@ahoppen ahoppen enabled auto-merge July 18, 2023 17:03
This also fixes a bug that caused multi-line documentation of children to be rendered incorrectly
@ahoppen ahoppen force-pushed the ahoppen/child-improvements branch from 7b8e86b to 9adf2df Compare July 18, 2023 20:13
@ahoppen
Copy link
Member Author

ahoppen commented Jul 18, 2023

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Jul 18, 2023

@swift-ci Please test Windows

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.

4 participants