8000 refactor(traverse): remove `get_unique_name_impl` by overlookmotel · Pull Request #10755 · oxc-project/oxc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor(traverse): remove get_unique_name_impl #10755

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

Merged

Conversation

overlookmotel
Copy link
Contributor
@overlookmotel overlookmotel commented May 1, 2025

Follow-on after #10562. Pure refactor. Merge get_unique_name_impl into get_unique_name.

@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label May 1, 2025
Copy link
codspeed-hq bot commented May 1, 2025

CodSpeed Instrumentation Performance Report

Merging #10755 will not alter performance

Comparing 05-01-refactor_traverse_remove_get_unique_name_impl_ (ae57125) with main (3fed792)

Summary

✅ 36 untouched benchmarks

@overlookmotel overlookmotel marked this pull request as ready for review May 1, 2025 13:43
Copy link
coderabbitai bot commented May 1, 2025

Warning

Rate limit exceeded

@graphite-app[bot] has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 9 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between b32e098 and ae57125.

📒 Files selected for processing (1)
  • crates/oxc_traverse/src/context/scoping.rs (1 hunks)

Walkthrough

The changes involve refactoring in the crates/oxc_traverse/src/context/scoping.rs file. Specifically, the wrapper function get_unique_name, which previously called get_unique_name_impl with identical arguments, has been removed. The internal function get_unique_name_impl has been renamed to get_unique_name, and its implementation remains unchanged. No other logic or test cases have been altered. The update eliminates an unnecessary layer of indirection in the codebase without affecting the behavior or output of the unique name generation functionality. Public and exported function declarations have been updated to reflect this change.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
crates/oxc_traverse/src/context/scoping.rs (2)

553-567: Clarify single-digit postfix logic. It's intentional to skip _1 and start at _2 (aligned with the provided test cases), but this behavior may be non-obvious to future readers. Consider adding a brief comment above this block to explain why _1 is omitted.


629-753: Test suite could be DRYed out. The exhaustive inline array of cases (especially the long sequence for 2–100) makes the file very large and harder to maintain. Consider programmatically generating numeric test cases with loops to reduce duplication.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b38338a and b32e098.

📒 Files selected for processing (1)
  • crates/oxc_traverse/src/context/scoping.rs (1 hunks)
🔇 Additional comments (6)
crates/oxc_traverse/src/context/scoping.rs (6)

520-524: Signature consolidation approved. The refactored get_unique_name function correctly merges the old wrapper and implementation, and the lifetimes on uid_names and allocator are accurate for the arena allocation model.


529-532: Initial UID construction is correct. Preallocating capacity and pushing the underscore then base string is efficient and clear.


542-552: Unsafe byte manipulation is sound. The safety comment correctly outlines why reinterpreting the bytes is valid, and reobtaining bytes after each push avoids stale pointers.


569-595: Double-digit and beyond logic looks robust. The loops correctly handle _10 through _99 and fall back to the general case.


603-622: Extended postfix loop is reliable. Truncating and appending with ItoaBuffer covers the full range up to u32::MAX without reallocations until necessary.


1-753:

✅ Verification successful

Ensure removal of the old wrapper is complete. We should verify there are no remaining references to get_unique_name_impl elsewhere in the codebase.
Provide a script to confirm:


🏁 Script executed:

#!/bin/bash
# Search for any leftover invocations or imports of the old helper
rg -n "get_unique_name_impl"

Length of output: 28


No leftover references to get_unique_name_impl found
Ran rg -n "get_unique_name_impl" across the repository and received no matches, confirming the old helper has been fully removed.

@overlookmotel
Copy link
Contributor Author

Small refactor only, so merging without review.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label May 1, 2025
Copy link
Contributor Author
overlookmotel commented May 1, 2025

Merge activity

Follow-on after #10562. Pure refactor. Merge `get_unique_name_impl` into `get_unique_name`.
@graphite-app graphite-app bot force-pushed the 05-01-refactor_traverse_remove_get_unique_name_impl_ branch from b32e098 to ae57125 Compare May 1, 2025 14:07
@graphite-app graphite-app bot merged commit ae57125 into main May 1, 2025
27 checks passed
@graphite-app graphite-app bot deleted the 05-01-refactor_traverse_remove_get_unique_name_impl_ branch May 1, 2025 14:15
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

1 participant
0