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) {
34043404 return Value (_env, result);
34053405}
34063406
3407+
3408+ #if (NAPI_VERSION > 2)
34073409// //////////////////////////////////////////////////////////////////////////////
34083410// CallbackScope class
34093411// //////////////////////////////////////////////////////////////////////////////
@@ -3431,6 +3433,7 @@ inline CallbackScope::operator napi_callback_scope() const {
34313433inline Napi::Env CallbackScope::Env () const {
34323434 return Napi::Env (_env);
34333435}
3436+ #endif
34343437
34353438// //////////////////////////////////////////////////////////////////////////////
34363439// AsyncContext class
Original file line number Diff line number Diff line change @@ -1671,6 +1671,7 @@ namespace Napi {
16711671 napi_escapable_handle_scope _scope;
16721672 };
16731673
1674+ #if (NAPI_VERSION > 2)
16741675 class CallbackScope {
16751676 public:
16761677 CallbackScope (napi_env env, napi_callback_scope scope);
@@ -1686,6 +1687,7 @@ namespace Napi {
16861687 napi_async_context _async_context;
16871688 napi_callback_scope _scope;
16881689 };
1690+ #endif
16891691
16901692 class AsyncContext {
16911693 public:
Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ Object InitBasicTypesValue(Env env);
1616Object InitBigInt (Env env);
1717#endif
1818Object InitBuffer (Env env);
19+ #if (NAPI_VERSION > 2)
1920Object InitCallbackScope (Env env);
21+ #endif
2022Object InitDataView (Env env);
2123Object InitDataViewReadWrite (Env env);
2224Object InitError (Env env);
@@ -50,7 +52,9 @@ Object Init(Env env, Object exports) {
5052 exports.Set (" bigint" , InitBigInt (env));
5153#endif
5254 exports.Set (" buffer" , InitBuffer (env));
55+ #if (NAPI_VERSION > 2)
5356 exports.Set (" callbackscope" , InitCallbackScope (env));
57+ #endif
5458 exports.Set (" dataview" , InitDataView (env));
5559 exports.Set (" dataview_read_write" , InitDataView (env));
5660 exports.Set (" dataview_read_write" , InitDataViewReadWrite (env));
Original file line number Diff line number Diff line change 22
33using namespace Napi ;
44
5+ #if (NAPI_VERSION > 2)
56namespace {
67
78static void RunInCallbackScope (const CallbackInfo& info) {
@@ -18,3 +19,4 @@ Object InitCallbackScope(Env env) {
1819 exports[" runInCallbackScope" ] = Function::New (env, RunInCallbackScope);
1920 return exports;
2021}
22+ #endif
Original file line number Diff line number Diff line change @@ -53,6 +53,12 @@ if ((process.env.npm_config_NAPI_VERSION !== undefined) &&
5353 testModules . splice ( testModules . indexOf ( 'typedarray-bigint' ) , 1 ) ;
5454}
5555
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+
5662if ( typeof global . gc === 'function' ) {
5763 console . log ( 'Starting test suite\n' ) ;
5864
You can’t perform that action at this time.
0 commit comments