Skip to content

feat(r8): Make startline, endline and original_startline optional#84

Merged
romtsn merged 5 commits intorz/feat/r8-tests-line-number-handlingfrom
rz/fix/r8-tests-member-metadata
Feb 16, 2026
Merged

feat(r8): Make startline, endline and original_startline optional#84
romtsn merged 5 commits intorz/feat/r8-tests-line-number-handlingfrom
rz/fix/r8-tests-member-metadata

Conversation

@romtsn
Copy link
Copy Markdown
Member

@romtsn romtsn commented Feb 9, 2026

Summary

  • Make startline, endline, and original_startline fields Option-typed on both Member (builder) and MemberMapping (mapper) structs
  • Replaces the earlier boolean flags (has_minified_range, has_line_mapping) — presence/absence is now encoded directly: startline.is_some() means a minified range was present, original_startline.is_some()
    means a line mapping existed
  • In the binary cache format, u32::MAX is used as a sentinel for absent values (via NONE_VALUE constant)
  • Change StackFrame.line from usize to Option<usize> to distinguish "no line provided" from "line 0"
  • Fix inverted line ranges in mapping parser (swap start/end when start > end)
  • Bumps cache version 4 → 5

Test plan

  • All existing tests pass (no regressions)
  • Same 5 known-failing r8-line-number-handling tests remain (will be fixed in subsequent PRs)

@romtsn romtsn requested a review from loewenheim February 9, 2026 16:31
Copy link
Copy Markdown
Contributor

@loewenheim loewenheim left a comment

Choose a reason for hiding this comment

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

If I read this right, has_minified_range is equivalent to startline and endline existing/being valid, and has_line_mapping is equivalent to original_startline existing/being valid. Is that correct? If it is, it would probably be better to make those fields optional.

@romtsn romtsn force-pushed the rz/fix/r8-tests-member-metadata branch from 169af30 to c22e0f9 Compare February 10, 2026 09:55
@romtsn romtsn force-pushed the rz/fix/r8-tests-option-line-type branch from 74783ef to 4921149 Compare February 10, 2026 09:55
@romtsn romtsn changed the title feat(r8): Add has_minified_range and has_line_mapping metadata to members feat(r8): Make startline, endline and original_startline optional Feb 10, 2026
@romtsn
Copy link
Copy Markdown
Member Author

romtsn commented Feb 10, 2026

Switched to Optional startline, endline and original_startline to make it cleaner and more idiomatic than the boolean flags

@romtsn romtsn requested a review from loewenheim February 10, 2026 12:41
@romtsn romtsn force-pushed the rz/fix/r8-tests-option-line-type branch from 4921149 to 532c271 Compare February 16, 2026 09:39
Base automatically changed from rz/fix/r8-tests-option-line-type to rz/feat/r8-tests-line-number-handling February 16, 2026 10:22
@romtsn romtsn force-pushed the rz/fix/r8-tests-member-metadata branch from 14e735b to b5f6e46 Compare February 16, 2026 10:25
romtsn and others added 5 commits February 16, 2026 11:28
…bers

Track whether a mapping line had an explicit minified range prefix
(e.g. `0:0:` or `1:5:`) and whether it had any line mapping at all.
This metadata is needed for correctly resolving no-line entries in
subsequent changes.

- LineMapping: add has_minified_range field
- Member (builder): add has_minified_range and has_line_mapping fields
- MemberMapping (mapper): propagate both fields
- cache Member (raw): replace _reserved bytes with the two new flags
- Bump cache version 4 → 5

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace has_minified_range and has_line_mapping bools with Option<usize>
fields on builder::Member and mapper::MemberMapping. startline/endline
are now None when no minified range prefix was present, and
original_startline is None when no line mapping existed.

In cache/raw.rs, use u32::MAX sentinel for absent values and add
Option-returning accessor methods (startline(), endline(),
original_startline()) replacing the removed bool accessors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Revert cache version bump (4 stays, struct layout unchanged)
- Make LineMapping.startline/endline Optional, remove has_minified_range
- Extract startline/endline variables in cache find_members_and_rules

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@romtsn romtsn force-pushed the rz/fix/r8-tests-member-metadata branch from b5f6e46 to f99aade Compare February 16, 2026 10:29
@romtsn romtsn merged commit 92bba06 into rz/feat/r8-tests-line-number-handling Feb 16, 2026
4 of 6 checks passed
@romtsn romtsn deleted the rz/fix/r8-tests-member-metadata branch February 16, 2026 12:39
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