Skip to content

Commit 5fae20a

Browse files
committed
doc: update comments on test conditions
1 parent 988e5c2 commit 5fae20a

6 files changed

Lines changed: 48 additions & 36 deletions

File tree

napi-inl.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,9 @@ inline bool Value::IsNumber() const {
376376
return Type() == napi_number;
377377
}
378378

379-
// currently experimental guard with definition of NAPI_EXPERIMENTAL that it is
380-
// released in once it is no longer experimental
379+
// Currently experimental guard with the definition of NAPI_EXPERIMENTAL.
380+
// Once it is no longer experimental guard with the NAPI_VERSION in which it is
381+
// released instead.
381382
#ifdef NAPI_EXPERIMENTAL
382383
inline bool Value::IsBigInt() const {
383384
return Type() == napi_bigint;
@@ -613,8 +614,9 @@ inline double Number::DoubleValue() const {
613614
return result;
614615
}
615616

616-
// currently experimental guard with definition of NAPI_EXPERIMENTAL that it is
617-
// released in once it is no longer experimental
617+
// Currently experimental guard with the definition of NAPI_EXPERIMENTAL.
618+
// Once it is no longer experimental guard with the NAPI_VERSION in which it is
619+
// released instead.
618620
#ifdef NAPI_EXPERIMENTAL
619621
////////////////////////////////////////////////////////////////////////////////
620622
// BigInt Class

napi.h

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ namespace Napi {
111111
class Value;
112112
class Boolean;
113113
class Number;
114-
// currently experimental guard with definition of NAPI_EXPERIMENTAL that it is
115-
// released in once it is no longer experimental
114+
// Currently experimental guard with the definition of NAPI_EXPERIMENTAL.
115+
// Once it is no longer experimental guard with the NAPI_VERSION in which it is
116+
// released instead.
116117
#ifdef NAPI_EXPERIMENTAL
117118
class BigInt;
118119
#endif // NAPI_EXPERIMENTAL
@@ -139,8 +140,9 @@ namespace Napi {
139140
typedef TypedArrayOf<uint32_t> Uint32Array; ///< Typed-array of unsigned 32-bit integers
140141
typedef TypedArrayOf<float> Float32Array; ///< Typed-array of 32-bit floating-point values
141142
typedef TypedArrayOf<double> Float64Array; ///< Typed-array of 64-bit floating-point values
142-
// currently experimental guard with definition of NAPI_EXPERIMENTAL that it is
143-
// released in once it is no longer experimental
143+
// Currently experimental guard with the definition of NAPI_EXPERIMENTAL.
144+
// Once it is no longer experimental guard with the NAPI_VERSION in which it is
145+
// released instead.
144146
#ifdef NAPI_EXPERIMENTAL
145147
typedef TypedArrayOf<int64_t> BigInt64Array; ///< Typed array of signed 64-bit integers
146148
typedef TypedArrayOf<uint64_t> BigUint64Array; ///< Typed array of unsigned 64-bit integers
@@ -244,8 +246,9 @@ namespace Napi {
244246
bool IsNull() const; ///< Tests if a value is a null JavaScript value.
245247
bool IsBoolean() const; ///< Tests if a value is a JavaScript boolean.
246248
bool IsNumber() const; ///< Tests if a value is a JavaScript number.
247-
// currently experimental guard with definition of NAPI_EXPERIMENTAL that it is
248-
// released in once it is no longer experimental
249+
// Currently experimental guard with the definition of NAPI_EXPERIMENTAL.
250+
// Once it is no longer experimental guard with the NAPI_VERSION in which it is
251+
// released instead.
249252
#ifdef NAPI_EXPERIMENTAL
250253
bool IsBigInt() const; ///< Tests if a value is a JavaScript bigint.
251254
#endif // NAPI_EXPERIMENTAL
@@ -321,8 +324,9 @@ namespace Napi {
321324
double DoubleValue() const; ///< Converts a Number value to a 64-bit floating-point value.
322325
};
323326

324-
// currently experimental guard with definition of NAPI_EXPERIMENTAL that it is
325-
// released in once it is no longer experimental
327+
// Currently experimental guard with the definition of NAPI_EXPERIMENTAL.
328+
// Once it is no longer experimental guard with the NAPI_VERSION in which it is
329+
// released instead.
326330
#ifdef NAPI_EXPERIMENTAL
327331
/// A JavaScript bigint value.
328332
class BigInt : public Value {
@@ -851,8 +855,9 @@ namespace Napi {
851855
: std::is_same<T, uint32_t>::value ? napi_uint32_array
852856
: std::is_same<T, float>::value ? napi_float32_array
853857
: std::is_same<T, double>::value ? napi_float64_array
854-
// currently experimental guard with definition of NAPI_EXPERIMENTAL that it is
855-
// released in once it is no longer experimental
858+
// Currently experimental guard with the definition of NAPI_EXPERIMENTAL.
859+
// Once it is no longer experimental guard with the NAPI_VERSION in which it is
860+
// released instead.
856861
#ifdef NAPI_EXPERIMENTAL
857862
: std::is_same<T, int64_t>::value ? napi_bigint64_array
858863
: std::is_same<T, uint64_t>::value ? napi_biguint64_array

test/bigint.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// currently experimental guard with version of NODE_MAJOR_VERSION that it is
2-
// released in once it is no longer experimental
1+
// Currently experimental guard with NODE_MAJOR_VERISION in which it was
2+
// released. Once it is no longer experimental guard with the NAPI_VERSION
3+
// in which it is released instead.
34
#if (NODE_MAJOR_VERSION >= 10)
45

56
#define NAPI_EXPERIMENTAL

test/binding.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ Object InitBasicTypesArray(Env env);
1010
Object InitBasicTypesBoolean(Env env);
1111
Object InitBasicTypesNumber(Env env);
1212
Object InitBasicTypesValue(Env env);
13-
// currently experimental guard with version of NODE_MAJOR_VERSION that it is
14-
// released in once it is no longer experimental
13+
// Currently experimental guard with NODE_MAJOR_VERISION in which it was
14+
// released. Once it is no longer experimental guard with the NAPI_VERSION
15+
// in which it is released instead.
1516
#if (NODE_MAJOR_VERSION >= 10)
1617
Object InitBigInt(Env env);
1718
#endif
@@ -55,8 +56,9 @@ Object Init(Env env, Object exports) {
5556
exports.Set("basic_types_boolean", InitBasicTypesBoolean(env));
5657
exports.Set("basic_types_number", InitBasicTypesNumber(env));
5758
exports.Set("basic_types_value", InitBasicTypesValue(env));
58-
// currently experimental guard with version of NODE_MAJOR_VERSION that it is
59-
// released in once it is no longer experimental
59+
// Currently experimental guard with NODE_MAJOR_VERISION in which it was
60+
// released. Once it is no longer experimental guard with the NAPI_VERSION
61+
// in which it is released instead.
6062
#if (NODE_MAJOR_VERSION >= 10)
6163
exports.Set("bigint", InitBigInt(env));
6264
#endif

test/index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,9 @@ const napiVersion = Number(process.versions.napi)
5252
const nodeMajorVersion = Number(process.versions.node.match(/\d+/)[0])
5353

5454
if (nodeMajorVersion < 10) {
55-
// currently experimental only test if node major version
56-
// is set to experimental. We can't use napi_experimental here
57-
// as that is not supported as a number on earlier
58-
// Node.js versions. Once bigint is in a release
59-
// this should be guarded on the napi version
60-
// in which bigint was added.
55+
// Currently experimental guard with NODE_MAJOR_VERISION in which it was
56+
// released. Once it is no longer experimental guard with the NAPI_VERSION
57+
// in which it is released instead.
6158
testModules.splice(testModules.indexOf('bigint'), 1);
6259
testModules.splice(testModules.indexOf('typedarray-bigint'), 1);
6360
}

test/typedarray.cc

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// currently experimental guard with version of NODE_MAJOR_VERSION that it is
2-
// released in once it is no longer experimental
1+
// Currently experimental guard with NODE_MAJOR_VERISION in which it was
2+
// released. Once it is no longer experimental guard with the NAPI_VERSION
3+
// in which it is released instead.
34
#if (NODE_MAJOR_VERSION >= 10)
45
#define NAPI_EXPERIMENTAL
56
#endif
@@ -69,8 +70,9 @@ Value CreateTypedArray(const CallbackInfo& info) {
6970
NAPI_TYPEDARRAY_NEW(Float64Array, info.Env(), length, napi_float64_array) :
7071
NAPI_TYPEDARRAY_NEW_BUFFER(Float64Array, info.Env(), length, buffer, bufferOffset,
7172
napi_float64_array);
72-
// currently experimental guard with version of NODE_MAJOR_VERSION that it is
73-
// released in once it is no longer experimental
73+
// Currently experimental guard with NODE_MAJOR_VERISION in which it was
74+
// released. Once it is no longer experimental guard with the NAPI_VERSION
75+
// in which it is released instead.
7476
#if (NODE_MAJOR_VERSION >= 10)
7577
} else if (arrayType == "bigint64") {
7678
return buffer.IsUndefined() ?
@@ -105,8 +107,9 @@ Value GetTypedArrayType(const CallbackInfo& info) {
105107
case napi_uint32_array: return String::New(info.Env(), "uint32");
106108
case napi_float32_array: return String::New(info.Env(), "float32");
107109
case napi_float64_array: return String::New(info.Env(), "float64");
108-
// currently experimental guard with version of NODE_MAJOR_VERSION that it is
109-
// released in once it is no longer experimental
110+
// Currently experimental guard with NODE_MAJOR_VERISION in which it was
111+
// released. Once it is no longer experimental guard with the NAPI_VERSION
112+
// in which it is released instead.
110113
#if (NODE_MAJOR_VERSION >= 10)
111114
case napi_bigint64_array: return String::New(info.Env(), "bigint64");
112115
case napi_biguint64_array: return String::New(info.Env(), "biguint64");
@@ -147,8 +150,9 @@ Value GetTypedArrayElement(const CallbackInfo& info) {
147150
return Number::New(info.Env(), array.As<Float32Array>()[index]);
148151
case napi_float64_array:
149152
return Number::New(info.Env(), array.As<Float64Array>()[index]);
150-
// currently experimental guard with version of NODE_MAJOR_VERSION that it is
151-
// released in once it is no longer experimental
153+
// Currently experimental guard with NODE_MAJOR_VERISION in which it was
154+
// released. Once it is no longer experimental guard with the NAPI_VERSION
155+
// in which it is released instead.
152156
#if (NODE_MAJOR_VERSION >= 10)
153157
case napi_bigint64_array:
154158
return BigInt::New(info.Env(), array.As<BigInt64Array>()[index]);
@@ -193,8 +197,9 @@ void SetTypedArrayElement(const CallbackInfo& info) {
193197
case napi_float64_array:
194198
array.As<Float64Array>()[index] = value.DoubleValue();
195199
break;
196-
// currently experimental guard with version of NODE_MAJOR_VERSION that it is
197-
// released in once it is no longer experimental
200+
// Currently experimental guard with NODE_MAJOR_VERISION in which it was
201+
// released. Once it is no longer experimental guard with the NAPI_VERSION
202+
// in which it is released instead.
198203
#if (NODE_MAJOR_VERSION >= 10)
199204
case napi_bigint64_array: {
200205
bool lossless;

0 commit comments

Comments
 (0)