Minor cleanups in enclosing_range path#143
Open
rvandermeulen wants to merge 1 commit into
Open
Conversation
semanticdbEnclosingRange used two separate lookups against file.sourceFileLinesMapping for the same end offset: lineNumberForOffset() called getLineByOffset, columnForOffset() called getLineAndColumnByOffset. Replace both single-purpose helpers with one call through the existing offsetToLineAndCol (now public) so the line and column come from a single FIR lookup. Also align the field-assignment order in semanticdbEnclosingRange with semanticdbRange (startCharacter, startLine, endCharacter, endLine) for local readability. No behavior change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two small cleanups around the
enclosing_rangeplumbing added in #123. No behavior change.LineMap:
semanticdbEnclosingRangelooked up the same end offset twice.lineNumberForOffsetcalledgetLineByOffset, andcolumnForOffsetcalledgetLineAndColumnByOffset(which already includes the line). This PR drops both single-purpose helpers and uses the existingoffsetToLineAndCol(now public) once at the call site, so a single FIR lookup yields both line and column.Field order:
semanticdbEnclosingRangeassigned theRangebuilder fields in(startLine, startCharacter, endLine, endCharacter)order while its siblingsemanticdbRangeuses(startCharacter, startLine, endCharacter, endLine). Align the new function with the existing one for local readability.Spotted while integrating #123 into a downstream fork. Filing without prior issue since the diff is minimal and self-contained; happy to revise if you'd prefer a different shape.