Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
danbev committed Apr 20, 2017
commit 7513d2c9abbf3c8f941dcc3d48df70476915a615
6 changes: 4 additions & 2 deletions src/stream_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ class ShutdownWrap : public ReqWrap<uv_shutdown_t>,
Wrap(req_wrap_obj, this);
}

NODE_DEPRECATED("Use lambda expression instead",
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);
Expand Down Expand Up @@ -83,9 +84,10 @@ class WriteWrap: public ReqWrap<uv_write_t>,

size_t self_size() const override { return storage_size_; }

NODE_DEPRECATED("Use lambda expression instead",
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);
Expand Down
8 changes: 6 additions & 2 deletions src/stream_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down