node-gyp/fix-addon-test-for-Node.js-12-and-v8.patch

36 lines
1.2 KiB
Diff
Raw Permalink Normal View History

From e6699d13cdcd6abe543b250f4297808912a4a188 Mon Sep 17 00:00:00 2001
From: Richard Lau <riclau@uk.ibm.com>
Date: Tue, 2 Apr 2019 19:42:13 +0100
Subject: [PATCH] test: fix addon test for Node.js 12 and V8 7.4
V8 7.4 removes some API functions. Replace those with their NAN
counterparts.
PR-URL: https://github.com/nodejs/node-gyp/pull/1705
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
---
test/node_modules/hello_world/hello.cc | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/test/node_modules/hello_world/hello.cc b/test/node_modules/hello_world/hello.cc
index 89bfd7ac04..ea724e896c 100644
--- a/test/node_modules/hello_world/hello.cc
+++ b/test/node_modules/hello_world/hello.cc
@@ -1,12 +1,11 @@
#include <nan.h>
-void Method(const Nan::FunctionCallbackInfo<v8::Value>& info) {
+NAN_METHOD(Method) {
info.GetReturnValue().Set(Nan::New("world").ToLocalChecked());
}
-void Init(v8::Local<v8::Object> exports) {
- exports->Set(Nan::New("hello").ToLocalChecked(),
- Nan::New<v8::FunctionTemplate>(Method)->GetFunction());
+NAN_MODULE_INIT(Init) {
+ Nan::SetMethod(target, "hello", Method);
}
NODE_MODULE(hello, Init)