From 1acab66df437c07cd655dc72e849f386162abb0c Mon Sep 17 00:00:00 2001 From: Kyle Farnung Date: Wed, 12 Jul 2017 17:14:00 -0700 Subject: [PATCH] n-api: directly create Local from Persistent The `v8::PersistentBase.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: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14211 Reviewed-By: Timothy Gu Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Michael Dawson Reviewed-By: Jason Ginchereau --- src/node_api.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node_api.cc b/src/node_api.cc index 986a9facccac9d..06f18562e7d3c0 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -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::New( \ + isolate, env->prefix ## _template); \ } \ } while (0)