File tree Expand file tree Collapse file tree 5 files changed +17
-0
lines changed Expand file tree Collapse file tree 5 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -3404,6 +3404,8 @@ inline Value EscapableHandleScope::Escape(napi_value escapee) {
3404
3404
return Value (_env, result);
3405
3405
}
3406
3406
3407
+
3408
+ #if (NAPI_VERSION > 2)
3407
3409
// //////////////////////////////////////////////////////////////////////////////
3408
3410
// CallbackScope class
3409
3411
// //////////////////////////////////////////////////////////////////////////////
@@ -3431,6 +3433,7 @@ inline CallbackScope::operator napi_callback_scope() const {
3431
3433
inline Napi::Env CallbackScope::Env () const {
3432
3434
return Napi::Env (_env);
3433
3435
}
3436
+ #endif
3434
3437
3435
3438
// //////////////////////////////////////////////////////////////////////////////
3436
3439
// AsyncContext class
Original file line number Diff line number Diff line change @@ -1671,6 +1671,7 @@ namespace Napi {
1671
1671
napi_escapable_handle_scope _scope;
1672
1672
};
1673
1673
1674
+ #if (NAPI_VERSION > 2)
1674
1675
class CallbackScope {
1675
1676
public:
1676
1677
CallbackScope (napi_env env, napi_callback_scope scope);
@@ -1686,6 +1687,7 @@ namespace Napi {
1686
1687
napi_async_context _async_context;
1687
1688
napi_callback_scope _scope;
1688
1689
};
1690
+ #endif
1689
1691
1690
1692
class AsyncContext {
1691
1693
public:
Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ Object InitBasicTypesValue(Env env);
16
16
Object InitBigInt (Env env);
17
17
#endif
18
18
Object InitBuffer (Env env);
19
+ #if (NAPI_VERSION > 2)
19
20
Object InitCallbackScope (Env env);
21
+ #endif
20
22
Object InitDataView (Env env);
21
23
Object InitDataViewReadWrite (Env env);
22
24
Object InitError (Env env);
@@ -50,7 +52,9 @@ Object Init(Env env, Object exports) {
50
52
exports.Set (" bigint" , InitBigInt (env));
51
53
#endif
52
54
exports.Set (" buffer" , InitBuffer (env));
55
+ #if (NAPI_VERSION > 2)
53
56
exports.Set (" callbackscope" , InitCallbackScope (env));
57
+ #endif
54
58
exports.Set (" dataview" , InitDataView (env));
55
59
exports.Set (" dataview_read_write" , InitDataView (env));
56
60
exports.Set (" dataview_read_write" , InitDataViewReadWrite (env));
Original file line number Diff line number Diff line change 2
2
3
3
using namespace Napi ;
4
4
5
+ #if (NAPI_VERSION > 2)
5
6
namespace {
6
7
7
8
static void RunInCallbackScope (const CallbackInfo& info) {
@@ -18,3 +19,4 @@ Object InitCallbackScope(Env env) {
18
19
exports[" runInCallbackScope" ] = Function::New (env, RunInCallbackScope);
19
20
return exports;
20
21
}
22
+ #endif
Original file line number Diff line number Diff line change @@ -53,6 +53,12 @@ if ((process.env.npm_config_NAPI_VERSION !== undefined) &&
53
53
testModules . splice ( testModules . indexOf ( 'typedarray-bigint' ) , 1 ) ;
54
54
}
55
55
56
+ if ( ( process . env . npm_config_NAPI_VERSION !== undefined ) &&
57
+ ( process . env . npm_config_NAPI_VERSION < 3 ) ) {
58
+ testModules . splice ( testModules . indexOf ( 'callbackscope' ) , 1 ) ;
59
+ testModules . splice ( testModules . indexOf ( 'version_management' ) , 1 ) ;
60
+ }
61
+
56
62
if ( typeof global . gc === 'function' ) {
57
63
console . log ( 'Starting test suite\n' ) ;
58
64
You can’t perform that action at this time.
0 commit comments