Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarshan Sen <darshan.sen@postman.com>2021-10-02 16:51:40 +0300
committerNode.js GitHub Bot <github-bot@iojs.org>2021-10-05 08:34:21 +0300
commit7b8552f5078f209fd3bbb935724d81cf5705aa11 (patch)
tree3861b845007351a23b6b1f85084a04a0c3c1bf0e /src/node_dtrace.cc
parent8fc4169452516669a2f66c670b423b8e14be0f77 (diff)
src: use `As()` instead of `Cast()` for conversions
We mostly use `As()` instead of `Cast()` in our code, so this change replaces the remaining calls to `Cast()` with calls to `As()` to maintain the consistency. Refs: https://github.com/nodejs/node/pull/39921/files#r702293529 Signed-off-by: Darshan Sen <darshan.sen@postman.com> PR-URL: https://github.com/nodejs/node/pull/40287 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Diffstat (limited to 'src/node_dtrace.cc')
-rw-r--r--src/node_dtrace.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/node_dtrace.cc b/src/node_dtrace.cc
index 7808a649a4a..52e63992833 100644
--- a/src/node_dtrace.cc
+++ b/src/node_dtrace.cc
@@ -87,8 +87,8 @@ using v8::Value;
return node::THROW_ERR_INVALID_ARG_TYPE(env, \
"expected object for " #obj " to contain object member " #member); \
} \
- *valp = Local<Object>::Cast(obj->Get(env->context(), \
- OneByteString(env->isolate(), #member)).ToLocalChecked());
+ *valp = obj->Get(env->context(), \
+ OneByteString(env->isolate(), #member)).ToLocalChecked().As<Object>();
#define SLURP_CONNECTION(arg, conn) \
if (!(arg)->IsObject()) { \
@@ -96,7 +96,7 @@ using v8::Value;
"expected argument " #arg " to be a connection object"); \
} \
node_dtrace_connection_t conn; \
- Local<Object> _##conn = Local<Object>::Cast(arg); \
+ Local<Object> _##conn = arg.As<Object>(); \
Local<Value> _handle = \
(_##conn)->Get(env->context(), \
FIXED_ONE_BYTE_STRING(env->isolate(), "_handle")) \
@@ -116,7 +116,7 @@ using v8::Value;
"expected argument " #arg " to be a connection object"); \
} \
node_dtrace_connection_t conn; \
- Local<Object> _##conn = Local<Object>::Cast(arg); \
+ Local<Object> _##conn = arg.As<Object>(); \
SLURP_INT(_##conn, fd, &conn.fd); \
SLURP_STRING(_##conn, host, &conn.remote); \
SLURP_INT(_##conn, port, &conn.port); \
@@ -132,10 +132,10 @@ using v8::Value;
"expected argument " #arg1 " to be a connection object"); \
} \
node_dtrace_connection_t conn; \
- Local<Object> _##conn = Local<Object>::Cast(arg0); \
+ Local<Object> _##conn = arg0.As<Object>(); \
SLURP_INT(_##conn, fd, &conn.fd); \
SLURP_INT(_##conn, bufferSize, &conn.buffered); \
- _##conn = Local<Object>::Cast(arg1); \
+ _##conn = arg1.As<Object>(); \
SLURP_STRING(_##conn, host, &conn.remote); \
SLURP_INT(_##conn, port, &conn.port);
@@ -165,7 +165,7 @@ void DTRACE_HTTP_SERVER_REQUEST(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
HandleScope scope(env->isolate());
- Local<Object> arg0 = Local<Object>::Cast(args[0]);
+ Local<Object> arg0 = args[0].As<Object>();
Local<Object> headers;
memset(&req, 0, sizeof(req));
@@ -217,7 +217,7 @@ void DTRACE_HTTP_CLIENT_REQUEST(const FunctionCallbackInfo<Value>& args) {
* caller here to retain their method and URL until the time at which
* DTRACE_HTTP_CLIENT_REQUEST can be called.
*/
- Local<Object> arg0 = Local<Object>::Cast(args[0]);
+ Local<Object> arg0 = args[0].As<Object>();
SLURP_STRING(arg0, _header, &header);
req.method = header;