Skip to content

fix(class-features): new.target is undefined in instance field initializers - #18704

Merged
JLHwung merged 1 commit into
7.xfrom
automation/backport-18677
Nov 24, 2026
Merged

JLHwung merged 1 commit into
7.xfrom
automation/backport-18677

Conversation

@babel-bot

Copy link
Copy Markdown
Collaborator

Backport of #18677 to 7.x

Cherry-picked commits:

  • 10d1c4f → fix(class-features): new.target is undefined in instance field initializers

Conflicts: Resolved.

  • packages/babel-helper-create-class-features-plugin/src/fields.ts: the MetaProperty visitor in thisContextVisitor differed on 7.x (it uses scope.buildUndefinedNode()). I took the new shared replaceNewTarget helper and kept path.scope.buildUndefinedNode() inside it, as 7.x does.

Checks: rebuild passed. Full test run: 277/278 suites pass; the 6 failures are in babel-code-frame/test/color-detection.js (ANSI color detection in the environment), unrelated to this change. lint failed with TypeScript errors in packages/babel-types/scripts/generators/* and a check-compat-data error. Neither touches the backported code, and they appear to be environmental. I did not fix them.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 🔙 Backport to 7.x for #18677 · copilot · auto · 16.9 AIC · ⌖ 0.647 AIC · ⊞ 9.4K · ◷

@babel-bot

babel-bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/63739

@pkg-pr-new

pkg-pr-new Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

commit: ea02e44

@JLHwung
JLHwung force-pushed the automation/backport-18677 branch from 73ad1ad to ea02e44 Compare November 23, 2026 20:49
@JLHwung
JLHwung added this pull request to the merge queue Nov 24, 2026
Merged via the queue into 7.x with commit da3a235 Nov 24, 2026
45 checks passed
@JLHwung
JLHwung deleted the automation/backport-18677 branch November 24, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7.x: backport PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Class Fields

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants