-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use new.target
instead of instanceof
to detect if its a constructor call
#7431
Conversation
stupid question but are you certain that all these classes have at least one test that calls the constructor without new? |
❌ @paperdave 10 files with test failures on bun-darwin-aarch64:
|
❌ @paperdave 6 files with test failures on linux-x64-baseline:
|
❌ @paperdave 6 files with test failures on linux-x64:
|
❌ @Jarred-Sumner 12 files with test failures on bun-darwin-x64:
|
❌ @paperdave 13 files with test failures on bun-darwin-x64-baseline:
|
in the future we need to not put multiple things into the same pr. i know that is hypocritical of me considering #6938 having like 50 changes, but still. i'm skeptical of the streams changes and would honestly want that as a separate pr. it feels like something we're going to end up breaking and have to revert, but you have valuable changes to the syntax highlighter and napi. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ive moved the changes not related to new.target to another pr.
changes to node:stream
must be done carefully. after looking over it a few times it looks alright, but i still wonder if there is anything that can break with using !new.target
i think this should only be merged after we manually verify that Next.js, Express, Fastify, Webpack, and some other packages that may abuse stream mechanics to verify they still work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(see prev comment)
What does this PR do?
Replaces usages of
with
It should be faster, though I have yet to benchmark it.
See also nodejs/node#51026
How did you verify your code works?
Existing tests should cover it