-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
src: clean up argument assertions in node_file.cc #18192
Conversation
src/node_file.cc
Outdated
Local<Context> context = env->context(); | ||
CHECK_GE(args.Length(), 2); | ||
|
||
int argc = args.Length(); |
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.
const int argc = ...
if you're caching it. .Length()
is really just an inexpensive pointer load though.
- Cache `args.Length()` - Use `value.As<T>()` to cast the arguments
6aebd6f
to
95d9201
Compare
Rebased and updated with @bnoordhuis's suggestion. |
Only one unrelated CI failure. Landed in e1c29f2, thanks! |
- Cache `args.Length()` - Use `value.As<T>()` to cast the arguments PR-URL: #18192 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This does not land cleanly on v9.x, would someone be willing to do a backport? |
This is cleaning up the code mostly came from semver-major changes, so does not make too much sense to backport. |
- Cache `args.Length()` - Use `value.As<T>()` to cast the arguments PR-URL: nodejs#18192 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
args.Length()
value.As<T>()
to cast the argumentsChecklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
fs