Skip to content
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

Add a SpanScanner.spanFromPosition() method #78

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

nex3
Copy link
Member

@nex3 nex3 commented Jul 2, 2024

Tracking raw ints can be more efficient than tracking LineScannerState objects, and allows users to do small manual manipulations on the resulting positions.

@kevmoo kevmoo requested review from devoncarew and natebosch July 2, 2024 23:43
lib/src/span_scanner.dart Outdated Show resolved Hide resolved
@natebosch
Copy link
Member

Can you add a brief description of the use case to the first comment so I can include it in the commit message?

Tracking raw ints can be more efficient than tracking
`LineScannerState` objects, and allows users to do small manual
manipulations on the resulting positions.
@nex3 nex3 force-pushed the span-from-position branch from 5063763 to 5df0981 Compare July 9, 2024 20:39
@nex3 nex3 requested a review from natebosch July 9, 2024 20:39
Comment on lines +100 to +102
/// Throws a [RangeError] if [startPosition] or [endPosition] aren't within
/// this source file.
FileSpan spanFromPosition(int startPosition, [int? endPosition]) =>
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to add the RangeError.checkValidRange call in this implementation?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this one is handled automatically by SourceFile.

@natebosch natebosch merged commit a40bbbd into dart-lang:master Jul 9, 2024
6 checks passed
@natebosch
Copy link
Member

Thanks! I'll start getting this rolled so that we can publish.

@natebosch
Copy link
Member

mosuem pushed a commit to dart-lang/tools that referenced this pull request Dec 11, 2024
…er#78)

Tracking raw ints can be more efficient than tracking
`LineScannerState` objects, and allows users to do small manual
manipulations on the resulting positions.
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.

2 participants