Skip to content

refactor(linter/plugins, napi/parser): document pointer arithmetic#21872

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/04-27-refactor_linter_plugins_napi_parser_simplify_pointer_arithmetic
Apr 30, 2026
Merged

refactor(linter/plugins, napi/parser): document pointer arithmetic#21872
graphite-app[bot] merged 1 commit intomainfrom
om/04-27-refactor_linter_plugins_napi_parser_simplify_pointer_arithmetic

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Apr 27, 2026

Refactor. Document some quite unintuitive pointer arithmetic, and avoid casting pointers to integers with as usize.

Copy link
Copy Markdown
Member Author

overlookmotel commented Apr 27, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@overlookmotel overlookmotel self-assigned this Apr 27, 2026
@overlookmotel overlookmotel marked this pull request as ready for review April 27, 2026 23:21
@overlookmotel overlookmotel requested a review from camc314 as a code owner April 27, 2026 23:21
Copilot AI review requested due to automatic review settings April 27, 2026 23:21
@overlookmotel overlookmotel added A-parser Area - Parser C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior A-linter-plugins Area - Linter JS plugins labels Apr 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors raw-transfer alignment calculations in the NAPI parser and oxlint JS plugin integration to avoid as usize pointer casts by using pointer .addr() APIs.

Changes:

  • Update get_buffer_offset implementations to use .addr() instead of casting pointers to integers.
  • Update external linter buffer alignment logic to use .addr() for rounding down to BLOCK_ALIGN.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
napi/parser/src/raw_transfer.rs Refactors get_buffer_offset pointer arithmetic to use .addr().
apps/oxlint/src/js_plugins/parse.rs Refactors get_buffer_offset pointer arithmetic to use .addr().
apps/oxlint/src/js_plugins/external_linter.rs Refactors buffer start computation to use .addr() instead of as usize.

Comment thread napi/parser/src/raw_transfer.rs Outdated
Comment thread apps/oxlint/src/js_plugins/parse.rs Outdated
@graphite-app graphite-app Bot force-pushed the om/04-27-feat_allocator_remove_allocator_end_ptr_method branch from ff6e93f to ac3e6e6 Compare April 27, 2026 23:44
@graphite-app graphite-app Bot force-pushed the om/04-27-refactor_linter_plugins_napi_parser_simplify_pointer_arithmetic branch from 5241b65 to b9878ee Compare April 27, 2026 23:44
@overlookmotel overlookmotel force-pushed the om/04-27-feat_allocator_remove_allocator_end_ptr_method branch from ac3e6e6 to 7bc3af5 Compare April 30, 2026 01:05
@overlookmotel overlookmotel force-pushed the om/04-27-refactor_linter_plugins_napi_parser_simplify_pointer_arithmetic branch from b9878ee to 214d596 Compare April 30, 2026 01:05
@overlookmotel overlookmotel changed the title refactor(linter/plugins, napi/parser): simplify pointer arithmetic refactor(linter/plugins, napi/parser): document pointer arithmetic Apr 30, 2026
@overlookmotel overlookmotel force-pushed the om/04-27-refactor_linter_plugins_napi_parser_simplify_pointer_arithmetic branch from 214d596 to b9891f8 Compare April 30, 2026 01:18
@overlookmotel overlookmotel force-pushed the om/04-27-feat_allocator_remove_allocator_end_ptr_method branch from 7bc3af5 to 19eacf6 Compare April 30, 2026 01:18
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app Bot commented Apr 30, 2026

Merge activity

…21872)

Refactor. Document some quite unintuitive pointer arithmetic, and avoid casting pointers to integers with `as usize`.
@graphite-app graphite-app Bot force-pushed the om/04-27-feat_allocator_remove_allocator_end_ptr_method branch from 19eacf6 to 0ffbe0d Compare April 30, 2026 01:29
@graphite-app graphite-app Bot force-pushed the om/04-27-refactor_linter_plugins_napi_parser_simplify_pointer_arithmetic branch from b9891f8 to aedc1b8 Compare April 30, 2026 01:29
Base automatically changed from om/04-27-feat_allocator_remove_allocator_end_ptr_method to main April 30, 2026 01:34
@graphite-app graphite-app Bot merged commit aedc1b8 into main Apr 30, 2026
26 checks passed
@graphite-app graphite-app Bot deleted the om/04-27-refactor_linter_plugins_napi_parser_simplify_pointer_arithmetic branch April 30, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter-plugins Area - Linter JS plugins A-parser Area - Parser C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants