diff options
author | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-11-08 11:43:50 +0100 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-11-11 08:02:30 +0100 |
commit | faa584ab22b61a29c1d73b28d1cbfae5cbabab04 (patch) | |
tree | b0d3e2c1b026f0ab58ef140b97412884583b4cb1 /doc | |
parent | 344d33eef110486bc094ba8d97a483379bf62752 (diff) | |
download | android-node-v8-faa584ab22b61a29c1d73b28d1cbfae5cbabab04.tar.gz android-node-v8-faa584ab22b61a29c1d73b28d1cbfae5cbabab04.tar.bz2 android-node-v8-faa584ab22b61a29c1d73b28d1cbfae5cbabab04.zip |
test: fix v8 Set/Get compiler warnings
PR-URL: https://github.com/nodejs/node/pull/24246
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/addons.md | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/doc/api/addons.md b/doc/api/addons.md index e2530acb77..d993c72d34 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -537,6 +537,7 @@ to invoke such callbacks: namespace demo { +using v8::Context; using v8::Function; using v8::FunctionCallbackInfo; using v8::Isolate; @@ -549,13 +550,14 @@ using v8::Value; void RunCallback(const FunctionCallbackInfo<Value>& args) { Isolate* isolate = args.GetIsolate(); + Local<Context> context = isolate->GetCurrentContext(); Local<Function> cb = Local<Function>::Cast(args[0]); const unsigned argc = 1; Local<Value> argv[argc] = { String::NewFromUtf8(isolate, "hello world", NewStringType::kNormal).ToLocalChecked() }; - cb->Call(Null(isolate), argc, argv); + cb->Call(context, Null(isolate), argc, argv).ToLocalChecked(); } void Init(Local<Object> exports, Local<Object> module) { @@ -612,10 +614,12 @@ void CreateObject(const FunctionCallbackInfo<Value>& args) { Local<Context> context = isolate->GetCurrentContext(); Local<Object> obj = Object::New(isolate); - obj->Set(String::NewFromUtf8(isolate, + obj->Set(context, + String::NewFromUtf8(isolate, "msg", NewStringType::kNormal).ToLocalChecked(), - args[0]->ToString(context).ToLocalChecked()); + args[0]->ToString(context).ToLocalChecked()) + .FromJust(); args.GetReturnValue().Set(obj); } @@ -803,9 +807,9 @@ void MyObject::Init(Local<Object> exports) { Local<Context> context = isolate->GetCurrentContext(); constructor.Reset(isolate, tpl->GetFunction(context).ToLocalChecked()); - exports->Set(String::NewFromUtf8( + exports->Set(context, String::NewFromUtf8( isolate, "MyObject", NewStringType::kNormal).ToLocalChecked(), - tpl->GetFunction(context).ToLocalChecked()); + tpl->GetFunction(context).ToLocalChecked()).FromJust(); } void MyObject::New(const FunctionCallbackInfo<Value>& args) { |