Skip to content

Support destroyObject(o) on ES6 class instances#13560

Draft
donmccurdy wants to merge 2 commits into
mainfrom
donmccurdy/feat/destroyObject-es6
Draft

Support destroyObject(o) on ES6 class instances#13560
donmccurdy wants to merge 2 commits into
mainfrom
donmccurdy/feat/destroyObject-es6

Conversation

@donmccurdy

@donmccurdy donmccurdy commented Jun 9, 2026

Copy link
Copy Markdown
Member

Description

Currently destroyObject(object) cannot see methods of ES6 class instances, and fails to replace them when the object is destroyed. As discussed in #12266, the behavior of destroyObject could perhaps be reconsidered. However, I think adoption of ES6 class syntax (and type checking, which ES6 classes are a prerequisite for) will be smoother if we can avoid unnecessary functional changes within the migration, so... I'd like to try making destroyObject compatible with ES6 classes.

This PR extends destroyObject to support ES6 class instances as input, and adds unit tests for both ES6 classes and prototype-based inheritance to verify that both continue to work as expected.

Issue number and link

Testing plan

See unit tests added.

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

AI acknowledgment

  • I used AI to generate content in this PR
  • If yes, I have reviewed the AI-generated content before submitting

If yes, I used the following Tools(s) and/or Service(s):

If yes, I used the following Model(s):

PR Dependency Tree

This tree was auto-generated by Charcoal

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Thank you for the pull request, @donmccurdy!

✅ We can confirm we have a CLA on file for you.

@donmccurdy
donmccurdy marked this pull request as draft June 10, 2026 02:46
@donmccurdy donmccurdy self-assigned this Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant