summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Bevenius <daniel.bevenius@gmail.com>2017-04-20 12:15:36 +0200
committerDaniel Bevenius <daniel.bevenius@gmail.com>2017-04-24 07:27:20 +0200
commit8eb7790a8883e829efa291af02b3beecdd62f78d (patch)
treebb0f45071099b9b155ff0422a175ba998be8144c /src
parentcf68280ce1c6f9ee13e4b85a05832993b7e1a3d3 (diff)
downloadandroid-node-v8-8eb7790a8883e829efa291af02b3beecdd62f78d.tar.gz
android-node-v8-8eb7790a8883e829efa291af02b3beecdd62f78d.tar.bz2
android-node-v8-8eb7790a8883e829efa291af02b3beecdd62f78d.zip
src: replace IsConstructCalls with lambda
I've added a deprecation notice as the functions are public, but not sure if this is correct or the format of the deprecation notice. PR-URL: https://github.com/nodejs/node/pull/12533 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src')
-rw-r--r--src/stream_base.h8
-rw-r--r--src/stream_wrap.cc8
2 files changed, 6 insertions, 10 deletions
diff --git a/src/stream_base.h b/src/stream_base.h
index 35929750bf..e2ef8d8d39 100644
--- a/src/stream_base.h
+++ b/src/stream_base.h
@@ -53,10 +53,6 @@ class ShutdownWrap : public ReqWrap<uv_shutdown_t>,
Wrap(req_wrap_obj, this);
}
- static void NewShutdownWrap(const v8::FunctionCallbackInfo<v8::Value>& args) {
- CHECK(args.IsConstructCall());
- }
-
static ShutdownWrap* from_req(uv_shutdown_t* req) {
return ContainerOf(&ShutdownWrap::req_, req);
}
@@ -83,10 +79,6 @@ class WriteWrap: public ReqWrap<uv_write_t>,
size_t self_size() const override { return storage_size_; }
- static void NewWriteWrap(const v8::FunctionCallbackInfo<v8::Value>& args) {
- CHECK(args.IsConstructCall());
- }
-
static WriteWrap* from_req(uv_write_t* req) {
return ContainerOf(&WriteWrap::req_, req);
}
diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc
index 099151fdb7..83c375b54b 100644
--- a/src/stream_wrap.cc
+++ b/src/stream_wrap.cc
@@ -59,15 +59,19 @@ void StreamWrap::Initialize(Local<Object> target,
Local<Context> context) {
Environment* env = Environment::GetCurrent(context);
+ auto is_construct_call_callback =
+ [](const FunctionCallbackInfo<Value>& args) {
+ CHECK(args.IsConstructCall());
+ };
Local<FunctionTemplate> sw =
- FunctionTemplate::New(env->isolate(), ShutdownWrap::NewShutdownWrap);
+ FunctionTemplate::New(env->isolate(), is_construct_call_callback);
sw->InstanceTemplate()->SetInternalFieldCount(1);
sw->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "ShutdownWrap"));
target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "ShutdownWrap"),
sw->GetFunction());
Local<FunctionTemplate> ww =
- FunctionTemplate::New(env->isolate(), WriteWrap::NewWriteWrap);
+ FunctionTemplate::New(env->isolate(), is_construct_call_callback);
ww->InstanceTemplate()->SetInternalFieldCount(1);
ww->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "WriteWrap"));
target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "WriteWrap"),