-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: remove usage of V8 deprecated APIs in node_url.cc #11066
Conversation
src/node_url.cc
Outdated
@@ -1316,7 +1318,8 @@ namespace url { | |||
Utf8Value input(env->isolate(), args[0]); | |||
enum url_parse_state override = kUnknownState; | |||
if (args[1]->IsNumber()) | |||
override = (enum url_parse_state)(args[1]->Uint32Value()); | |||
override = (enum url_parse_state)( | |||
args[1]->Uint32Value(env->context()).ToChecked()); |
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.
We use FromJust
in the code base
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.
Fixed.
src/node_url.cc
Outdated
@@ -1316,7 +1318,8 @@ namespace url { | |||
Utf8Value input(env->isolate(), args[0]); | |||
enum url_parse_state override = kUnknownState; | |||
if (args[1]->IsNumber()) |
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.
I'd add braces here for clarity now that it expands on two lines
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.
LGTM with a suggestion
src/node_url.cc
Outdated
override = (enum url_parse_state)(args[1]->Uint32Value()); | ||
if (args[1]->IsNumber()) { | ||
override = (enum url_parse_state)( | ||
args[1]->Uint32Value(env->context()).FromJust()); |
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.
Can you turn this into a reinterpret_cast
and rename override
to something that’s not a language keyword?
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.
Turns out static_cast
works but reinterpret_cast
doesn't. override
bit fixed.
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.
LGTM, looks like it needs a rebase
Also: - Avoid using 'override' as variable name - Use explicit static_cast instead of C-style cast
7edd9ed
to
58cc121
Compare
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.
Thanks, LGTM!
New CI after rebase: https://ci.nodejs.org/job/node-test-pull-request/6127/ |
Some failures in that last CI run, trying again: https://ci.nodejs.org/job/node-test-pull-request/6138/ |
Landed in c7e1be8. |
Also: - Avoid using 'override' as variable name - Use explicit static_cast instead of C-style cast PR-URL: #11066 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Also: - Avoid using 'override' as variable name - Use explicit static_cast instead of C-style cast PR-URL: nodejs#11066 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Also: - Avoid using 'override' as variable name - Use explicit static_cast instead of C-style cast PR-URL: nodejs#11066 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
CI: https://ci.nodejs.org/job/node-test-pull-request/6097/
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
url