Skip to content

Comments

fix(mangler): keep names for parenthesized functions and classes#13421

Merged
graphite-app[bot] merged 1 commit intomainfrom
08-30-fix_mangler_keep_names_for_parenthesized_functions_and_classes
Aug 30, 2025
Merged

fix(mangler): keep names for parenthesized functions and classes#13421
graphite-app[bot] merged 1 commit intomainfrom
08-30-fix_mangler_keep_names_for_parenthesized_functions_and_classes

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Aug 30, 2025

@github-actions github-actions bot added A-ast Area - AST C-bug Category - Bug labels Aug 30, 2025
Copy link
Member Author


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 hot fixes, skip the queue and merge this PR next

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.

@sapphi-red sapphi-red marked this pull request as ready for review August 30, 2025 10:31
Copilot AI review requested due to automatic review settings August 30, 2025 10:31
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 fixes a bug where the mangler was not properly preserving names for parenthesized function and class expressions. The issue was that expressions wrapped in parentheses (like var a = (function () {})) were not being recognized as function/class expressions that should have their names preserved.

  • Updates expression matching logic to look through parentheses when determining if an expression is a function or class
  • Adds test cases for parenthesized function expressions, arrow functions, and class expressions

Reviewed Changes

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

File Description
crates/oxc_mangler/src/keep_names.rs Updates the class detection logic to use without_parentheses() and adds test cases for parenthesized expressions
crates/oxc_ast/src/ast_impl/js.rs Updates is_anonymous_function_definition method to look through parentheses when checking expression types

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

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 30, 2025

CodSpeed Instrumentation Performance Report

Merging #13421 will not alter performance

Comparing 08-30-fix_mangler_keep_names_for_parenthesized_functions_and_classes (e3f953d) with main (3f3b93d)1

Summary

✅ 37 untouched benchmarks

Footnotes

  1. No successful run was found on main (b30bff5) during the generation of this report, so 3f3b93d was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Aug 30, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 30, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 08-30-fix_mangler_keep_names_for_parenthesized_functions_and_classes branch from 2d79c82 to e3f953d Compare August 30, 2025 11:10
@graphite-app graphite-app bot merged commit e3f953d into main Aug 30, 2025
24 checks passed
@graphite-app graphite-app bot deleted the 08-30-fix_mangler_keep_names_for_parenthesized_functions_and_classes branch August 30, 2025 11:15
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant