-
Notifications
You must be signed in to change notification settings - Fork 440
[SourceLocationConverter] Performance improvement #2663
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
@swift-ci Please test |
var position: AbsolutePosition = .startOfFile | ||
let addLine = { (lineLength: SourceLength) in | ||
var sourceLocationDirectives: [(sourceLine: Int, arguments: SourceLocationDirectiveArguments?)] = [] | ||
let prefix = tree.raw.forEachLineLength { lineLength in |
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.
prefix
doesn’t really make sense as a variable name here, right? Shouldn’t it be sourceFileLength
or something? Also, the usage of prefix
in RawSyntax.forEachLineLength
+ the comment on it seem pretty confusing to me. Not your doing but might be worth to clean that up along the way.
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.
This prefix
is more like lastLineLength
. I changed the naming so.
I didn't changed the naming in forEachLineLength
functions, because I wasn't able to come up with better naming. It's like "the length of the current line so far"
e54f8d1
to
6a81e49
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
@swift-ci Please test |
@swift-ci Please test macOS |
TokenSequence
. Instead, visitRawSyntax
tree manuallyArray
ofRawTriviaPiece
. Instead, scan the whole token text directly if available#sourceLocation()
directives in one-pass