Skip to content

Commit

Permalink
Fix deprecation warnings in test suite.
Browse files Browse the repository at this point in the history
This commit was brought to you by `perl -i -pe` (well, mostly - I did
some manual fixups.)

PR-URL: #825
Reviewed-By: Benjamin Byholm <bbyholm@abo.fi>
  • Loading branch information
bnoordhuis committed Nov 26, 2018
1 parent 509859c commit e222068
Show file tree
Hide file tree
Showing 35 changed files with 132 additions and 119 deletions.
6 changes: 4 additions & 2 deletions test/cpp/accessors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ NAN_MODULE_INIT(SetterGetter::Init) {
);

v8::Local<v8::Function> createnew =
Nan::New<v8::FunctionTemplate>(CreateNew)->GetFunction();
Nan::GetFunction(
Nan::New<v8::FunctionTemplate>(CreateNew)).ToLocalChecked();
Set(target, Nan::New<v8::String>("create").ToLocalChecked(), createnew);
}

Expand All @@ -70,7 +71,8 @@ v8::Local<v8::Value> SetterGetter::NewInstance () {
v8::Local<v8::FunctionTemplate> constructorHandle =
Nan::New(settergetter_constructor);
v8::Local<v8::Object> instance =
Nan::NewInstance(constructorHandle->GetFunction()).ToLocalChecked();
Nan::NewInstance(
Nan::GetFunction(constructorHandle).ToLocalChecked()).ToLocalChecked();
return scope.Escape(instance);
}

Expand Down
6 changes: 4 additions & 2 deletions test/cpp/accessors2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ NAN_MODULE_INIT(SetterGetter::Init) {
tpl->InstanceTemplate()->SetInternalFieldCount(1);
SetPrototypeMethod(tpl, "log", SetterGetter::Log);
v8::Local<v8::Function> createnew =
Nan::New<v8::FunctionTemplate>(CreateNew)->GetFunction();
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(CreateNew))
.ToLocalChecked();
Set(target, Nan::New<v8::String>("create").ToLocalChecked(), createnew);
}

Expand All @@ -58,7 +59,8 @@ v8::Local<v8::Value> SetterGetter::NewInstance () {
v8::Local<v8::FunctionTemplate> constructorHandle =
Nan::New(settergetter_constructor);
v8::Local<v8::Object> instance =
Nan::NewInstance(constructorHandle->GetFunction()).ToLocalChecked();
Nan::NewInstance(Nan::GetFunction(constructorHandle).ToLocalChecked())
.ToLocalChecked();
SetAccessor(
instance
, Nan::New("prop1").ToLocalChecked()
Expand Down
2 changes: 1 addition & 1 deletion test/cpp/asyncprogressqueueworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ NAN_METHOD(DoProgress) {
NAN_MODULE_INIT(Init) {
Set(target
, New<v8::String>("doProgress").ToLocalChecked()
, New<v8::FunctionTemplate>(DoProgress)->GetFunction());
, GetFunction(New<v8::FunctionTemplate>(DoProgress)).ToLocalChecked());
}

NODE_MODULE(asyncprogressqueueworker, Init)
2 changes: 1 addition & 1 deletion test/cpp/asyncprogressqueueworkerstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ NAN_METHOD(DoProgress) {
NAN_MODULE_INIT(Init) {
Set(target
, New<v8::String>("doProgress").ToLocalChecked()
, New<v8::FunctionTemplate>(DoProgress)->GetFunction());
, GetFunction(New<v8::FunctionTemplate>(DoProgress)).ToLocalChecked());
}

NODE_MODULE(asyncprogressqueueworkerstream, Init)
2 changes: 1 addition & 1 deletion test/cpp/asyncprogressworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ NAN_METHOD(DoProgress) {
NAN_MODULE_INIT(Init) {
Set(target
, New<v8::String>("a").ToLocalChecked()
, New<v8::FunctionTemplate>(DoProgress)->GetFunction());
, GetFunction(New<v8::FunctionTemplate>(DoProgress)).ToLocalChecked());
}

NODE_MODULE(asyncprogressworker, Init)
2 changes: 1 addition & 1 deletion test/cpp/asyncprogressworkersignal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ NAN_METHOD(DoProgress) {
NAN_MODULE_INIT(Init) {
Set(target
, New<v8::String>("a").ToLocalChecked()
, New<v8::FunctionTemplate>(DoProgress)->GetFunction());
, GetFunction(New<v8::FunctionTemplate>(DoProgress)).ToLocalChecked());
}

NODE_MODULE(asyncprogressworkersignal, Init)
2 changes: 1 addition & 1 deletion test/cpp/asyncprogressworkerstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ NAN_METHOD(DoProgress) {
NAN_MODULE_INIT(Init) {
Set(target
, New<v8::String>("a").ToLocalChecked()
, New<v8::FunctionTemplate>(DoProgress)->GetFunction());
, GetFunction(New<v8::FunctionTemplate>(DoProgress)).ToLocalChecked());
}

NODE_MODULE(asyncprogressworkerstream, Init)
2 changes: 1 addition & 1 deletion test/cpp/asyncworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ NAN_METHOD(DoSleep) {
NAN_MODULE_INIT(Init) {
Set(target
, New<v8::String>("a").ToLocalChecked()
, New<v8::FunctionTemplate>(DoSleep)->GetFunction());
, GetFunction(New<v8::FunctionTemplate>(DoSleep)).ToLocalChecked());
}

NODE_MODULE(asyncworker, Init)
2 changes: 1 addition & 1 deletion test/cpp/asyncworkererror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NAN_METHOD(Work) {
NAN_MODULE_INIT(Init) {
Set(target
, New("a").ToLocalChecked()
, New<v8::FunctionTemplate>(Work)->GetFunction());
, GetFunction(New<v8::FunctionTemplate>(Work)).ToLocalChecked());
}

NODE_MODULE(asyncworkererror, Init)
8 changes: 4 additions & 4 deletions test/cpp/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ NAN_MODULE_INIT(Init) {
}
Set(target
, New<v8::String>("new1").ToLocalChecked()
, New<v8::FunctionTemplate>(New1)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(New1)).ToLocalChecked()
);
Set(target
, New<v8::String>("new2").ToLocalChecked()
, New<v8::FunctionTemplate>(New2)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(New2)).ToLocalChecked()
);
Set(target
, New<v8::String>("new3").ToLocalChecked()
, New<v8::FunctionTemplate>(New3)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(New3)).ToLocalChecked()
);
Set(target
, New<v8::String>("copy").ToLocalChecked()
, New<v8::FunctionTemplate>(Copy)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(Copy)).ToLocalChecked()
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/cpp/bufferworkerpersistent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ NAN_METHOD(DoSleep) {
NAN_MODULE_INIT(Init) {
Set(target
, New<v8::String>("a").ToLocalChecked()
, New<v8::FunctionTemplate>(DoSleep)->GetFunction());
, GetFunction(New<v8::FunctionTemplate>(DoSleep)).ToLocalChecked());
}

NODE_MODULE(bufferworkerpersistent, Init)
30 changes: 15 additions & 15 deletions test/cpp/converters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,63 +75,63 @@ NAN_METHOD(Int32Value) {
NAN_MODULE_INIT(Init) {
Set(target
, New<v8::String>("toBoolean").ToLocalChecked()
, New<v8::FunctionTemplate>(ToBoolean)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(ToBoolean)).ToLocalChecked()
);
Set(target
, New<v8::String>("toNumber").ToLocalChecked()
, New<v8::FunctionTemplate>(ToNumber)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(ToNumber)).ToLocalChecked()
);
Set(target
, New<v8::String>("toString").ToLocalChecked()
, New<v8::FunctionTemplate>(ToString)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(ToString)).ToLocalChecked()
);
Set(target
, New<v8::String>("toDetailString").ToLocalChecked()
, New<v8::FunctionTemplate>(ToDetailString)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(ToDetailString)).ToLocalChecked()
);
Set(target
, New<v8::String>("toFunction").ToLocalChecked()
, New<v8::FunctionTemplate>(ToFunction)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(ToFunction)).ToLocalChecked()
);
Set(target
, New<v8::String>("toObject").ToLocalChecked()
, New<v8::FunctionTemplate>(ToObject)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(ToObject)).ToLocalChecked()
);
Set(target
, New<v8::String>("toInteger").ToLocalChecked()
, New<v8::FunctionTemplate>(ToInteger)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(ToInteger)).ToLocalChecked()
);
Set(target
, New<v8::String>("toUint32").ToLocalChecked()
, New<v8::FunctionTemplate>(ToUint32)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(ToUint32)).ToLocalChecked()
);
Set(target
, New<v8::String>("toInt32").ToLocalChecked()
, New<v8::FunctionTemplate>(ToInt32)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(ToInt32)).ToLocalChecked()
);
Set(target
, New<v8::String>("toArrayIndex").ToLocalChecked()
, New<v8::FunctionTemplate>(ToArrayIndex)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(ToArrayIndex)).ToLocalChecked()
);
Set(target
, New<v8::String>("booleanValue").ToLocalChecked()
, New<v8::FunctionTemplate>(BooleanValue)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(BooleanValue)).ToLocalChecked()
);
Set(target
, New<v8::String>("numberValue").ToLocalChecked()
, New<v8::FunctionTemplate>(NumberValue)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(NumberValue)).ToLocalChecked()
);
Set(target
, New<v8::String>("integerValue").ToLocalChecked()
, New<v8::FunctionTemplate>(IntegerValue)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(IntegerValue)).ToLocalChecked()
);
Set(target
, New<v8::String>("uint32Value").ToLocalChecked()
, New<v8::FunctionTemplate>(Uint32Value)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(Uint32Value)).ToLocalChecked()
);
Set(target
, New<v8::String>("int32Value").ToLocalChecked()
, New<v8::FunctionTemplate>(Int32Value)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(Int32Value)).ToLocalChecked()
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/cpp/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ X(TypeError)
Nan::Set( \
target \
, Nan::New(#NAME).ToLocalChecked() \
, Nan::New<v8::FunctionTemplate>(NAME)->GetFunction());
, Nan::GetFunction(New<v8::FunctionTemplate>(NAME)).ToLocalChecked());


NAN_MODULE_INIT(Init) {
Expand Down
4 changes: 2 additions & 2 deletions test/cpp/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ NAN_METHOD(Check) {
NAN_MODULE_INIT(Init) {
Set(target
, New<v8::String>("hook").ToLocalChecked()
, New<v8::FunctionTemplate>(Hook)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(Hook)).ToLocalChecked()
);
Set(target
, New<v8::String>("check").ToLocalChecked()
, New<v8::FunctionTemplate>(Check)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(Check)).ToLocalChecked()
);
}

Expand Down
6 changes: 4 additions & 2 deletions test/cpp/indexedinterceptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ NAN_MODULE_INIT(IndexedInterceptor::Init) {
, IndexedInterceptor::PropertyEnumerator);

v8::Local<v8::Function> createnew =
Nan::New<v8::FunctionTemplate>(CreateNew)->GetFunction();
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(CreateNew))
.ToLocalChecked();
Set(target, Nan::New("create").ToLocalChecked(), createnew);
}

Expand All @@ -59,7 +60,8 @@ v8::Local<v8::Value> IndexedInterceptor::NewInstance () {
v8::Local<v8::FunctionTemplate> constructorHandle =
Nan::New(indexedinterceptors_constructor);
v8::Local<v8::Object> instance =
Nan::NewInstance(constructorHandle->GetFunction()).ToLocalChecked();
Nan::NewInstance(Nan::GetFunction(constructorHandle).ToLocalChecked())
.ToLocalChecked();
return scope.Escape(instance);
}

Expand Down
2 changes: 1 addition & 1 deletion test/cpp/isolatedata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ NAN_METHOD(SetAndGet) {
NAN_MODULE_INIT(Init) {
Set(target
, New<v8::String>("setAndGet").ToLocalChecked()
, New<v8::FunctionTemplate>(SetAndGet)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(SetAndGet)).ToLocalChecked()
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/cpp/json-parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ NAN_METHOD(Parse) {
NAN_MODULE_INIT(Init) {
Nan::Set(target
, Nan::New<v8::String>("parse").ToLocalChecked()
, Nan::New<v8::FunctionTemplate>(Parse)->GetFunction()
, Nan::GetFunction(Nan::New<v8::FunctionTemplate>(Parse)).ToLocalChecked()
);
}

Expand Down
3 changes: 2 additions & 1 deletion test/cpp/json-stringify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ NAN_METHOD(Stringify) {
NAN_MODULE_INIT(Init) {
Nan::Set(target
, Nan::New<v8::String>("stringify").ToLocalChecked()
, Nan::New<v8::FunctionTemplate>(Stringify)->GetFunction()
, Nan::GetFunction(Nan::New<v8::FunctionTemplate>(Stringify))
.ToLocalChecked()
);
}

Expand Down
5 changes: 3 additions & 2 deletions test/cpp/makecallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ NAN_MODULE_INIT(MyObject::Init) {

SetPrototypeMethod(tpl, "call_emit", CallEmit);

constructor.Reset(tpl->GetFunction());
Set(target, Nan::New("MyObject").ToLocalChecked(), tpl->GetFunction());
v8::Local<v8::Function> function = GetFunction(tpl).ToLocalChecked();
constructor.Reset(function);
Set(target, Nan::New("MyObject").ToLocalChecked(), function);
}

NAN_METHOD(MyObject::New) {
Expand Down
17 changes: 8 additions & 9 deletions test/cpp/morenews.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,36 +68,35 @@ NAN_METHOD(NewExternalAsciiStringResource) {
NAN_MODULE_INIT(Init) {
Set(target
, New("newNumber").ToLocalChecked()
, New<v8::FunctionTemplate>(NewNumber)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(NewNumber)).ToLocalChecked()
);
Set(target
, New("newNegativeInteger").ToLocalChecked()
, New<v8::FunctionTemplate>(NewNegativeInteger)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(NewNegativeInteger)).ToLocalChecked()
);
Set(target
, New("newPositiveInteger").ToLocalChecked()
, New<v8::FunctionTemplate>(NewPositiveInteger)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(NewPositiveInteger)).ToLocalChecked()
);
Set(target
, New("newUtf8String").ToLocalChecked()
, New<v8::FunctionTemplate>(NewUtf8String)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(NewUtf8String)).ToLocalChecked()
);
Set(target
, New("newLatin1String").ToLocalChecked()
, New<v8::FunctionTemplate>(NewLatin1String)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(NewLatin1String)).ToLocalChecked()
);
Set(target
, New("newUcs2String").ToLocalChecked()
, New<v8::FunctionTemplate>(NewUcs2String)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(NewUcs2String)).ToLocalChecked()
);
Set(target
, New("newExternalStringResource").ToLocalChecked()
, New<v8::FunctionTemplate>(NewExternalStringResource)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(NewExternalStringResource)).ToLocalChecked()
);
Set(target
, New("newExternalAsciiStringResource").ToLocalChecked()
, New<v8::FunctionTemplate>(NewExternalAsciiStringResource)
->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(NewExternalAsciiStringResource)).ToLocalChecked()
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/cpp/multifile1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using namespace Nan; // NOLINT(build/namespaces)
NAN_MODULE_INIT(Init) {
Set(target
, New<v8::String>("r").ToLocalChecked()
, New<v8::FunctionTemplate>(ReturnString)->GetFunction()
, GetFunction(New<v8::FunctionTemplate>(ReturnString)).ToLocalChecked()
);
}

Expand Down
6 changes: 4 additions & 2 deletions test/cpp/namedinterceptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ NAN_MODULE_INIT(NamedInterceptor::Init) {
, NamedInterceptor::PropertyEnumerator);

v8::Local<v8::Function> createnew =
Nan::New<v8::FunctionTemplate>(CreateNew)->GetFunction();
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(CreateNew))
.ToLocalChecked();
Set(target, Nan::New("create").ToLocalChecked(), createnew);
}

Expand All @@ -59,7 +60,8 @@ v8::Local<v8::Value> NamedInterceptor::NewInstance () {
v8::Local<v8::FunctionTemplate> constructorHandle =
Nan::New(namedinterceptors_constructor);
v8::Local<v8::Object> instance =
Nan::NewInstance(constructorHandle->GetFunction()).ToLocalChecked();
Nan::NewInstance(GetFunction(constructorHandle).ToLocalChecked())
.ToLocalChecked();
return scope.Escape(instance);
}

Expand Down
Loading

0 comments on commit e222068

Please sign in to comment.