Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix compiler warning in doc/api/addons.md #23323

Closed
Closed
Changes from all commits
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
11 changes: 8 additions & 3 deletions doc/api/addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ property `msg` that echoes the string passed to `createObject()`:

namespace demo {

using v8::Context;
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
Expand All @@ -596,9 +597,11 @@ using v8::Value;

void CreateObject(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Local<Context> context = isolate->GetCurrentContext();

Local<Object> obj = Object::New(isolate);
obj->Set(String::NewFromUtf8(isolate, "msg"), args[0]->ToString(isolate));
obj->Set(String::NewFromUtf8(isolate, "msg"),
args[0]->ToString(context).ToLocalChecked());

args.GetReturnValue().Set(obj);
}
Expand Down Expand Up @@ -1078,6 +1081,7 @@ that can take two `MyObject` objects as input arguments:

namespace demo {

using v8::Context;
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
Expand All @@ -1092,11 +1096,12 @@ void CreateObject(const FunctionCallbackInfo<Value>& args) {

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

MyObject* obj1 = node::ObjectWrap::Unwrap<MyObject>(
args[0]->ToObject(isolate));
args[0]->ToObject(context).ToLocalChecked());
MyObject* obj2 = node::ObjectWrap::Unwrap<MyObject>(
args[1]->ToObject(isolate));
args[1]->ToObject(context).ToLocalChecked());

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