Skip to content

Commit

Permalink
n-api: directly create Local from Persistent
Browse files Browse the repository at this point in the history
The `v8::PersistentBase<T>.Get` method didn't exist in node 4 and it's
just a helper which creates a new `v8::Local` from the given object.

Backport-PR-URL: #19447
PR-URL: #14211
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
  • Loading branch information
kfarnung authored and MylesBorins committed Apr 16, 2018
1 parent f4d1cae commit 1acab66
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/node_api.cc
Expand Up @@ -58,7 +58,8 @@ struct napi_env__ {
(destination)->SetInternalFieldCount((field_count)); \
(env)->prefix ## _template.Reset(isolate, (destination)); \
} else { \
(destination) = env->prefix ## _template.Get(isolate); \
(destination) = v8::Local<v8::ObjectTemplate>::New( \
isolate, env->prefix ## _template); \
} \
} while (0)

Expand Down

0 comments on commit 1acab66

Please sign in to comment.