Skip to content

Commit 0a0dc00

Browse files
committed
squash: fix compiler warning 07_passing_wrapped_ob
Currently the following compiler warning is emitted: 1 warning generated. ../addon.cc:24:16: warning: 'ToObject' is deprecated: Use maybe version [-Wdeprecated-declarations] args[0]->ToObject(isolate)); ^ ./deps/v8/include/v8.h:2539:3: note: 'ToObject' has been explicitly marked deprecated here V8_DEPRECATED("Use maybe version", ^ This commit updates example to use the non-deprecated version.
1 parent 6e1fdb8 commit 0a0dc00

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

doc/api/addons.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,7 @@ that can take two `MyObject` objects as input arguments:
10811081

10821082
namespace demo {
10831083

1084+
using v8::Context;
10841085
using v8::FunctionCallbackInfo;
10851086
using v8::Isolate;
10861087
using v8::Local;
@@ -1095,11 +1096,12 @@ void CreateObject(const FunctionCallbackInfo<Value>& args) {
10951096

10961097
void Add(const FunctionCallbackInfo<Value>& args) {
10971098
Isolate* isolate = args.GetIsolate();
1099+
Local<Context> context = isolate->GetCurrentContext();
10981100

10991101
MyObject* obj1 = node::ObjectWrap::Unwrap<MyObject>(
1100-
args[0]->ToObject(isolate));
1102+
args[0]->ToObject(context).ToLocalChecked());
11011103
MyObject* obj2 = node::ObjectWrap::Unwrap<MyObject>(
1102-
args[1]->ToObject(isolate));
1104+
args[1]->ToObject(context).ToLocalChecked());
11031105

11041106
double sum = obj1->value() + obj2->value();
11051107
args.GetReturnValue().Set(Number::New(isolate, sum));

0 commit comments

Comments
 (0)