Skip to content

Fix RawSyntax's leading/trailingTrivia computation to return nil if the outermost children don't have leading/trailing trivia #8

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

Conversation

nathawes
Copy link

@nathawes nathawes commented Sep 7, 2018

Previously they would skip over outer children that didn't have leading/trailing trivia until they found one that did. This was causing those trivia to be included twice when computing the totalLength/byteSize of the node; once in leading/trailingTrivia and again in contentLength, which only skipped the trivia of the outermost children.

…ts outermost children don't have leading/trailing trivia

Previously if would skip over outer children that didn't have leading/trailing
trivia until it found one that did. This was causing that trivia to be included
twice when computing the totalLength/byteSize of the node; once in
leading/trailingTrivia and again in contentlength, which only skipped the trivia
of the outmost children.
@nathawes nathawes requested a review from nkcsgexi September 7, 2018 21:49
@nathawes
Copy link
Author

nathawes commented Sep 7, 2018

@swift-ci please test

Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

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

Looking good, Thank you for fixing it! @nathawes

@nathawes nathawes merged commit 88fcc8b into swiftlang:master Sep 7, 2018
@ahoppen
Copy link
Member

ahoppen commented Sep 8, 2018

Good catch. Thanks. We should also cherry-pick this over to swift-4.2-branch once #6 is merged.

allevato pushed a commit to allevato/swift-syntax that referenced this pull request Sep 17, 2018
…h-when-last-child-has-no-trailing-trivia

Fix RawSyntax's leading/trailingTrivia computation to return nil if the outermost children don't have leading/trailing trivia
nkcsgexi added a commit that referenced this pull request Sep 17, 2018
[4.2] Merge pull request #8 from nathawes/fix-rawsyntax-totallength-when-la…
CippoX added a commit to CippoX/swift-syntax that referenced this pull request Mar 21, 2023
# This is the 1st commit message:

fixed testAvailabilityQuery34 and testAvailabilityQueryUnavailability28

# This is the commit message swiftlang#2:

Update Sources/SwiftParserDiagnostics/ParseDiagnosticsGenerator.swift

Co-authored-by: Kim de Vos <[email protected]>
# This is the commit message swiftlang#3:

added fixedSource in test case

# This is the commit message swiftlang#4:

minor changes

# This is the commit message swiftlang#5:

implemented recovery inside the parser

# This is the commit message swiftlang#6:

runned format.py

# This is the commit message swiftlang#7:

minor changes

# This is the commit message swiftlang#8:

minor changes
adevress pushed a commit to adevress/swift-syntax that referenced this pull request Jan 14, 2024
Indent line comments correctly when they precede a continuation line.
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.

3 participants