Skip to content

Preserve computed object method keys#36389

Open
raashish1601 wants to merge 1 commit intofacebook:mainfrom
raashish1601:codex/compiler-computed-object-method-key
Open

Preserve computed object method keys#36389
raashish1601 wants to merge 1 commit intofacebook:mainfrom
raashish1601:codex/compiler-computed-object-method-key

Conversation

@raashish1601
Copy link
Copy Markdown

Summary

  • preserve computed object method keys when generating object methods
  • add a compiler fixture covering computed method shorthand output

Why

Object properties already forward the computed-key flag to Babel codegen, but object methods always passed false. That caused computed method shorthand like {[computedKey]() {}} to print as {computedKey() {}}, changing the property name.

Fixes #35203.

Test Plan

  • corepack yarn workspace snap run build
  • corepack yarn workspace snap run snap --update --pattern computed-object-method-key --sync
  • corepack yarn workspace snap run snap --pattern computed-object-method-key --sync
  • corepack yarn workspace babel-plugin-react-compiler run lint -- --quiet
  • corepack yarn prettier

@meta-cla meta-cla Bot added the CLA Signed label May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compiler Bug]: React compiler discards computed property keys when used in method shorthand

1 participant