Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Add a SpanScanner.spanFromPosition() method#78

Merged
natebosch merged 1 commit into
dart-archive:masterfrom
nex3:span-from-position
Jul 9, 2024
Merged

Add a SpanScanner.spanFromPosition() method#78
natebosch merged 1 commit into
dart-archive:masterfrom
nex3:span-from-position

Conversation

@nex3

@nex3 nex3 commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

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
Comment thread lib/src/span_scanner.dart Outdated
@natebosch

Copy link
Copy Markdown
Contributor

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 thread lib/src/span_scanner.dart
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
Copy Markdown
Contributor

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
Copy Markdown
Contributor 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-archive:master Jul 9, 2024
@natebosch

Copy link
Copy Markdown
Contributor

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

@natebosch

Copy link
Copy Markdown
Contributor

mosuem pushed a commit to dart-lang/tools that referenced this pull request Dec 11, 2024
…anner#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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants