File tree Expand file tree Collapse file tree 6 files changed +12
-30
lines changed
Expand file tree Collapse file tree 6 files changed +12
-30
lines changed Original file line number Diff line number Diff line change 1212#include < node_object_wrap.h>
1313#include < node_buffer.h>
1414
15- // v8::Object::GetPrototype has been deprecated. See http://crbug.com/333672197
16- #if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >= 13
17- #define USE_GETPROTOTYPEV2
18- #endif
19-
2015struct Addon ;
2116class Database ;
2217class Statement ;
Original file line number Diff line number Diff line change @@ -363,11 +363,7 @@ NODE_METHOD(Statement::JS_columns) {
363363 );
364364 columns.emplace_back (
365365 v8::Object::New (isolate,
366- #ifdef USE_GETPROTOTYPEV2
367- v8::Object::New (isolate)->GetPrototypeV2 (),
368- #else
369- v8::Object::New (isolate)->GetPrototype (),
370- #endif
366+ GET_PROTOTYPE (v8::Object::New (isolate)),
371367 keys.data (),
372368 values.data (),
373369 keys.size ()
Original file line number Diff line number Diff line change @@ -33,18 +33,10 @@ class Binder {
3333 };
3434
3535 static bool IsPlainObject (v8::Isolate* isolate, v8::Local<v8::Object> obj) {
36- #ifdef USE_GETPROTOTYPEV2
37- v8::Local<v8::Value> proto = obj->GetPrototypeV2 ();
38- #else
39- v8::Local<v8::Value> proto = obj->GetPrototype ();
40- #endif
36+ v8::Local<v8::Value> proto = GET_PROTOTYPE (obj);
4137 v8::Local<v8::Context> ctx = obj->GetCreationContext ().ToLocalChecked ();
4238 ctx->Enter ();
43- #ifdef USE_GETPROTOTYPEV2
44- v8::Local<v8::Value> baseProto = v8::Object::New (isolate)->GetPrototypeV2 ();
45- #else
46- v8::Local<v8::Value> baseProto = v8::Object::New (isolate)->GetPrototype ();
47- #endif
39+ v8::Local<v8::Value> baseProto = GET_PROTOTYPE (v8::Object::New (isolate));
4840 ctx->Exit ();
4941 return proto->StrictEquals (baseProto) || proto->StrictEquals (v8::Null (isolate));
5042 }
Original file line number Diff line number Diff line change @@ -146,11 +146,7 @@ namespace Data {
146146 }
147147 return v8::Object::New (
148148 isolate,
149- #ifdef USE_GETPROTOTYPEV2
150- v8::Object::New (isolate)->GetPrototypeV2 (),
151- #else
152- v8::Object::New (isolate)->GetPrototype (),
153- #endif
149+ GET_PROTOTYPE (v8::Object::New (isolate)),
154150 keys.data (),
155151 values.data (),
156152 column_count
Original file line number Diff line number Diff line change 44#define NODE_GETTER (name ) void name (v8::Local<v8::Name> _, const v8::PropertyCallbackInfo<v8::Value>& info)
55#define INIT (name ) v8::Local<v8::Function> name (v8::Isolate* isolate, v8::Local<v8::External> data)
66
7+ #if defined(V8_MAJOR_VERSION) && V8_MAJOR_VERSION >= 13
8+ // v8::Object::GetPrototype has been deprecated. See http://crbug.com/333672197
9+ #define GET_PROTOTYPE (obj ) ((obj)->GetPrototypeV2 ())
10+ #else
11+ #define GET_PROTOTYPE (obj ) ((obj)->GetPrototype ())
12+ #endif
13+
714#define EasyIsolate v8::Isolate* isolate = v8::Isolate::GetCurrent()
815#define OnlyIsolate info.GetIsolate()
916#define OnlyContext isolate->GetCurrentContext ()
Original file line number Diff line number Diff line change @@ -33,11 +33,7 @@ class RowBuilder {
3333 }
3434
3535 return v8::Object::New (isolate,
36- #ifdef USE_GETPROTOTYPEV2
37- v8::Object::New (isolate)->GetPrototypeV2 (),
38- #else
39- v8::Object::New (isolate)->GetPrototype (),
40- #endif
36+ GET_PROTOTYPE (v8::Object::New (isolate)),
4137 keys.data (),
4238 values.data (),
4339 column_count
You can’t perform that action at this time.
0 commit comments