Skip to content

Conversation

@ulrichstark
Copy link
Contributor

This makes code easier to understand that only either adds or removes context flags.

Copilot AI review requested due to automatic review settings October 13, 2025 20:53
Copy link
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

This PR refactors the parser by introducing two new convenience functions context_add and context_remove to simplify code that only needs to either add or remove context flags, making it more readable than the generic context function.

  • Adds context_add and context_remove helper functions to the parser
  • Replaces calls to the generic context function with the more specific helpers where appropriate
  • Removes an unused import in the module file

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/oxc_parser/src/cursor.rs Introduces the new context_add and context_remove helper functions
crates/oxc_parser/src/ts/types.rs Replaces generic context calls with specific context_add/context_remove calls
crates/oxc_parser/src/js/statement.rs Updates context calls to use the new helper functions
crates/oxc_parser/src/js/object.rs Simplifies context usage with the new helper functions
crates/oxc_parser/src/js/module.rs Updates context calls and removes unused Context import
crates/oxc_parser/src/js/function.rs Updates context call to use context_add
crates/oxc_parser/src/js/expression.rs Replaces multiple context calls with the appropriate helper functions
crates/oxc_parser/src/js/class.rs Updates context call to use context_add
crates/oxc_parser/src/js/binding.rs Simplifies context usage with context_add

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions github-actions bot added A-parser Area - Parser C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Oct 13, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 13, 2025

CodSpeed Performance Report

Merging #14567 will not alter performance

Comparing ulrichstark:introduce-context_add-and-context_remove-functions (ea913ef) with main (b301795)

Summary

✅ 37 untouched

@Boshen Boshen merged commit 496dd62 into oxc-project:main Oct 14, 2025
28 checks passed
@ulrichstark ulrichstark deleted the introduce-`context_add`-and-`context_remove`-functions branch October 14, 2025 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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