koffi 2.3.4 → 2.3.6-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/doc/changelog.md +4 -0
  3. package/doc/index.rst +1 -2
  4. package/doc/types.md +3 -3
  5. package/package.json +5 -5
  6. package/src/cnoke/cnoke.js +40 -834
  7. package/src/cnoke/package.json +1 -0
  8. package/src/cnoke/src/builder.js +447 -0
  9. package/src/cnoke/src/index.js +20 -0
  10. package/src/cnoke/src/tools.js +401 -0
  11. package/src/core/libcc/libcc.cc +2 -2
  12. package/src/koffi/build/2.3.6-beta.1/koffi_darwin_arm64/koffi.node +0 -0
  13. package/src/koffi/build/2.3.6-beta.1/koffi_darwin_x64/koffi.node +0 -0
  14. package/src/koffi/build/2.3.6-beta.1/koffi_freebsd_arm64/koffi.node +0 -0
  15. package/src/koffi/build/2.3.6-beta.1/koffi_freebsd_ia32/koffi.node +0 -0
  16. package/src/koffi/build/2.3.6-beta.1/koffi_freebsd_x64/koffi.node +0 -0
  17. package/src/koffi/build/2.3.6-beta.1/koffi_linux_arm32hf/koffi.node +0 -0
  18. package/src/koffi/build/2.3.6-beta.1/koffi_linux_arm64/koffi.node +0 -0
  19. package/src/koffi/build/2.3.6-beta.1/koffi_linux_ia32/koffi.node +0 -0
  20. package/src/koffi/build/2.3.6-beta.1/koffi_linux_riscv64hf64/koffi.node +0 -0
  21. package/src/koffi/build/2.3.6-beta.1/koffi_linux_x64/koffi.node +0 -0
  22. package/src/koffi/build/2.3.6-beta.1/koffi_openbsd_ia32/koffi.node +0 -0
  23. package/src/koffi/build/2.3.6-beta.1/koffi_openbsd_x64/koffi.node +0 -0
  24. package/src/koffi/build/2.3.6-beta.1/koffi_win32_arm64/koffi.exp +0 -0
  25. package/src/koffi/build/2.3.6-beta.1/koffi_win32_arm64/koffi.lib +0 -0
  26. package/src/koffi/build/2.3.6-beta.1/koffi_win32_arm64/koffi.node +0 -0
  27. package/src/koffi/build/2.3.6-beta.1/koffi_win32_arm64/koffi.pdb +0 -0
  28. package/src/koffi/build/2.3.6-beta.1/koffi_win32_ia32/koffi.exp +0 -0
  29. package/src/koffi/build/2.3.6-beta.1/koffi_win32_ia32/koffi.lib +0 -0
  30. package/src/koffi/build/2.3.6-beta.1/koffi_win32_ia32/koffi.node +0 -0
  31. package/src/koffi/build/2.3.6-beta.1/koffi_win32_ia32/koffi.pdb +0 -0
  32. package/src/koffi/build/2.3.6-beta.1/koffi_win32_x64/koffi.exp +0 -0
  33. package/src/koffi/build/2.3.6-beta.1/koffi_win32_x64/koffi.lib +0 -0
  34. package/src/koffi/build/2.3.6-beta.1/koffi_win32_x64/koffi.node +0 -0
  35. package/src/koffi/build/2.3.6-beta.1/koffi_win32_x64/koffi.pdb +0 -0
  36. package/src/koffi/src/abi_arm32.cc +43 -14
  37. package/src/koffi/src/abi_arm64.cc +95 -21
  38. package/src/koffi/src/abi_riscv64.cc +125 -64
  39. package/src/koffi/src/abi_x64_sysv.cc +38 -20
  40. package/src/koffi/src/abi_x64_win.cc +11 -5
  41. package/src/koffi/src/abi_x86.cc +14 -7
  42. package/src/koffi/src/call.cc +114 -44
  43. package/src/koffi/src/call.hh +6 -4
  44. package/src/koffi/src/ffi.cc +172 -147
  45. package/src/koffi/src/ffi.hh +18 -10
  46. package/src/koffi/src/index.d.ts +28 -7
  47. package/src/koffi/src/index.js +23 -4
  48. package/src/koffi/src/util.cc +261 -69
  49. package/src/koffi/src/util.hh +34 -8
  50. package/vendor/node-addon-api/CHANGELOG.md +122 -9
  51. package/vendor/node-addon-api/CONTRIBUTING.md +10 -10
  52. package/vendor/node-addon-api/README.md +36 -12
  53. package/vendor/node-addon-api/benchmark/function_args.cc +95 -62
  54. package/vendor/node-addon-api/benchmark/function_args.js +6 -6
  55. package/vendor/node-addon-api/benchmark/index.js +1 -1
  56. package/vendor/node-addon-api/benchmark/property_descriptor.cc +27 -34
  57. package/vendor/node-addon-api/benchmark/property_descriptor.js +5 -4
  58. package/vendor/node-addon-api/doc/async_operations.md +1 -1
  59. package/vendor/node-addon-api/doc/async_worker_variants.md +23 -2
  60. package/vendor/node-addon-api/doc/cmake-js.md +1 -1
  61. package/vendor/node-addon-api/doc/error_handling.md +3 -3
  62. package/vendor/node-addon-api/doc/external.md +7 -0
  63. package/vendor/node-addon-api/doc/handle_scope.md +14 -0
  64. package/vendor/node-addon-api/doc/hierarchy.md +1 -1
  65. package/vendor/node-addon-api/doc/object.md +27 -0
  66. package/vendor/node-addon-api/index.js +3 -3
  67. package/vendor/node-addon-api/napi-inl.deprecated.h +121 -127
  68. package/vendor/node-addon-api/napi-inl.h +1178 -1144
  69. package/vendor/node-addon-api/napi.h +2786 -2675
  70. package/vendor/node-addon-api/package.json +42 -1
  71. package/vendor/node-addon-api/test/addon.cc +8 -6
  72. package/vendor/node-addon-api/test/addon_build/index.js +9 -9
  73. package/vendor/node-addon-api/test/addon_build/tpl/addon.cc +2 -1
  74. package/vendor/node-addon-api/test/addon_build/tpl/index.js +4 -4
  75. package/vendor/node-addon-api/test/addon_data.cc +12 -13
  76. package/vendor/node-addon-api/test/array_buffer.js +3 -2
  77. package/vendor/node-addon-api/test/async_progress_queue_worker.cc +13 -3
  78. package/vendor/node-addon-api/test/async_progress_queue_worker.js +5 -5
  79. package/vendor/node-addon-api/test/async_progress_worker.cc +65 -9
  80. package/vendor/node-addon-api/test/async_progress_worker.js +14 -9
  81. package/vendor/node-addon-api/test/async_worker.cc +236 -3
  82. package/vendor/node-addon-api/test/async_worker.js +122 -37
  83. package/vendor/node-addon-api/test/async_worker_nocallback.js +9 -3
  84. package/vendor/node-addon-api/test/async_worker_persistent.js +2 -2
  85. package/vendor/node-addon-api/test/basic_types/array.js +3 -4
  86. package/vendor/node-addon-api/test/basic_types/boolean.cc +4 -2
  87. package/vendor/node-addon-api/test/basic_types/boolean.js +1 -2
  88. package/vendor/node-addon-api/test/basic_types/number.cc +12 -6
  89. package/vendor/node-addon-api/test/basic_types/number.js +19 -18
  90. package/vendor/node-addon-api/test/basic_types/value.cc +52 -1
  91. package/vendor/node-addon-api/test/basic_types/value.js +44 -21
  92. package/vendor/node-addon-api/test/bigint.cc +2 -1
  93. package/vendor/node-addon-api/test/binding.cc +11 -5
  94. package/vendor/node-addon-api/test/binding.gyp +3 -1
  95. package/vendor/node-addon-api/test/buffer.cc +46 -38
  96. package/vendor/node-addon-api/test/buffer.js +12 -12
  97. package/vendor/node-addon-api/test/callbackInfo.cc +27 -0
  98. package/vendor/node-addon-api/test/callbackInfo.js +9 -0
  99. package/vendor/node-addon-api/test/callbackscope.cc +19 -2
  100. package/vendor/node-addon-api/test/callbackscope.js +20 -20
  101. package/vendor/node-addon-api/test/common/index.js +37 -4
  102. package/vendor/node-addon-api/test/dataview/dataview.js +5 -5
  103. package/vendor/node-addon-api/test/dataview/dataview_read_write.js +14 -12
  104. package/vendor/node-addon-api/test/date.cc +2 -1
  105. package/vendor/node-addon-api/test/date.js +2 -2
  106. package/vendor/node-addon-api/test/env_cleanup.cc +12 -0
  107. package/vendor/node-addon-api/test/env_cleanup.js +38 -39
  108. package/vendor/node-addon-api/test/error.cc +6 -5
  109. package/vendor/node-addon-api/test/error_terminating_environment.js +64 -60
  110. package/vendor/node-addon-api/test/external.cc +36 -32
  111. package/vendor/node-addon-api/test/external.js +43 -46
  112. package/vendor/node-addon-api/test/function.cc +58 -44
  113. package/vendor/node-addon-api/test/function.js +4 -0
  114. package/vendor/node-addon-api/test/function_reference.cc +15 -13
  115. package/vendor/node-addon-api/test/globalObject/global_object_delete_property.js +50 -53
  116. package/vendor/node-addon-api/test/globalObject/global_object_get_property.js +33 -34
  117. package/vendor/node-addon-api/test/globalObject/global_object_has_own_property.js +38 -40
  118. package/vendor/node-addon-api/test/globalObject/global_object_set_property.js +47 -49
  119. package/vendor/node-addon-api/test/handlescope.cc +29 -3
  120. package/vendor/node-addon-api/test/handlescope.js +5 -3
  121. package/vendor/node-addon-api/test/index.js +1 -5
  122. package/vendor/node-addon-api/test/maybe/check.cc +49 -3
  123. package/vendor/node-addon-api/test/maybe/index.js +19 -7
  124. package/vendor/node-addon-api/test/memory_management.cc +9 -8
  125. package/vendor/node-addon-api/test/memory_management.js +2 -2
  126. package/vendor/node-addon-api/test/movable_callbacks.js +2 -2
  127. package/vendor/node-addon-api/test/name.js +3 -3
  128. package/vendor/node-addon-api/test/napi_child.js +2 -2
  129. package/vendor/node-addon-api/test/object/delete_property.js +7 -7
  130. package/vendor/node-addon-api/test/object/finalizer.cc +13 -12
  131. package/vendor/node-addon-api/test/object/finalizer.js +2 -2
  132. package/vendor/node-addon-api/test/object/get_property.js +6 -6
  133. package/vendor/node-addon-api/test/object/has_own_property.js +3 -3
  134. package/vendor/node-addon-api/test/object/has_property.js +4 -4
  135. package/vendor/node-addon-api/test/object/object.cc +191 -111
  136. package/vendor/node-addon-api/test/object/object.js +53 -52
  137. package/vendor/node-addon-api/test/object/object_deprecated.cc +24 -20
  138. package/vendor/node-addon-api/test/object/object_deprecated.js +3 -8
  139. package/vendor/node-addon-api/test/object/object_freeze_seal.js +54 -54
  140. package/vendor/node-addon-api/test/object/object_type_tag.cc +39 -0
  141. package/vendor/node-addon-api/test/object/object_type_tag.js +55 -0
  142. package/vendor/node-addon-api/test/object/subscript_operator.js +2 -2
  143. package/vendor/node-addon-api/test/object_reference.js +100 -100
  144. package/vendor/node-addon-api/test/objectwrap.cc +41 -34
  145. package/vendor/node-addon-api/test/objectwrap.js +23 -19
  146. package/vendor/node-addon-api/test/objectwrap_constructor_exception.cc +5 -5
  147. package/vendor/node-addon-api/test/objectwrap_constructor_exception.js +1 -1
  148. package/vendor/node-addon-api/test/objectwrap_multiple_inheritance.cc +7 -7
  149. package/vendor/node-addon-api/test/objectwrap_multiple_inheritance.js +1 -1
  150. package/vendor/node-addon-api/test/objectwrap_removewrap.js +24 -32
  151. package/vendor/node-addon-api/test/objectwrap_worker_thread.js +5 -4
  152. package/vendor/node-addon-api/test/promise.cc +7 -0
  153. package/vendor/node-addon-api/test/promise.js +3 -1
  154. package/vendor/node-addon-api/test/reference.cc +1 -1
  155. package/vendor/node-addon-api/test/reference.js +2 -2
  156. package/vendor/node-addon-api/test/run_script.cc +1 -1
  157. package/vendor/node-addon-api/test/symbol.js +59 -66
  158. package/vendor/node-addon-api/test/testUtil.js +6 -6
  159. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function.cc +64 -29
  160. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function.js +71 -34
  161. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_ctx.cc +111 -19
  162. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_ctx.js +2 -1
  163. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_existing_tsfn.cc +36 -26
  164. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_existing_tsfn.js +5 -5
  165. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_ptr.cc +3 -2
  166. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_ptr.js +1 -1
  167. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_sum.cc +47 -32
  168. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_sum.js +3 -3
  169. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_unref.cc +22 -9
  170. package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_unref.js +76 -31
  171. package/vendor/node-addon-api/test/thunking_manual.cc +61 -74
  172. package/vendor/node-addon-api/test/thunking_manual.js +6 -7
  173. package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function.cc +20 -20
  174. package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function.js +19 -19
  175. package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_ctx.cc +57 -5
  176. package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_ctx.js +2 -0
  177. package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_existing_tsfn.js +5 -5
  178. package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_ptr.cc +5 -1
  179. package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_ptr.js +4 -3
  180. package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_sum.js +3 -3
  181. package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_unref.cc +14 -0
  182. package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_unref.js +76 -31
  183. package/vendor/node-addon-api/test/typedarray-bigint.js +2 -2
  184. package/vendor/node-addon-api/test/typedarray.cc +263 -70
  185. package/vendor/node-addon-api/test/typedarray.js +44 -10
  186. package/vendor/node-addon-api/test/version_management.cc +16 -15
  187. package/vendor/node-addon-api/test/version_management.js +18 -20
  188. package/vendor/node-addon-api/tools/check-napi.js +13 -14
  189. package/vendor/node-addon-api/tools/conversion.js +161 -169
  190. package/vendor/node-addon-api/tools/eslint-format.js +9 -1
  191. package/vendor/node-addon-api/unit-test/README.md +4 -4
  192. package/src/koffi/build/2.3.4/koffi_darwin_arm64.tar.gz +0 -0
  193. package/src/koffi/build/2.3.4/koffi_darwin_x64.tar.gz +0 -0
  194. package/src/koffi/build/2.3.4/koffi_freebsd_arm64.tar.gz +0 -0
  195. package/src/koffi/build/2.3.4/koffi_freebsd_ia32.tar.gz +0 -0
  196. package/src/koffi/build/2.3.4/koffi_freebsd_x64.tar.gz +0 -0
  197. package/src/koffi/build/2.3.4/koffi_linux_arm32hf.tar.gz +0 -0
  198. package/src/koffi/build/2.3.4/koffi_linux_arm64.tar.gz +0 -0
  199. package/src/koffi/build/2.3.4/koffi_linux_ia32.tar.gz +0 -0
  200. package/src/koffi/build/2.3.4/koffi_linux_riscv64hf64.tar.gz +0 -0
  201. package/src/koffi/build/2.3.4/koffi_linux_x64.tar.gz +0 -0
  202. package/src/koffi/build/2.3.4/koffi_openbsd_ia32.tar.gz +0 -0
  203. package/src/koffi/build/2.3.4/koffi_openbsd_x64.tar.gz +0 -0
  204. package/src/koffi/build/2.3.4/koffi_win32_arm64.tar.gz +0 -0
  205. package/src/koffi/build/2.3.4/koffi_win32_ia32.tar.gz +0 -0
  206. package/src/koffi/build/2.3.4/koffi_win32_x64.tar.gz +0 -0
@@ -4,8 +4,8 @@ const assert = require('assert');
4
4
 
5
5
  module.exports = require('../common').runTest(test);
6
6
 
7
- function test(binding) {
8
- function testHasProperty(nativeHasProperty) {
7
+ function test (binding) {
8
+ function testHasProperty (nativeHasProperty) {
9
9
  const obj = { one: 1 };
10
10
 
11
11
  Object.defineProperty(obj, 'two', { value: 2 });
@@ -16,14 +16,14 @@ function test(binding) {
16
16
  assert.strictEqual(nativeHasProperty(obj, 'toString'), true);
17
17
  }
18
18
 
19
- function testShouldThrowErrorIfKeyIsInvalid(nativeHasProperty) {
19
+ function testShouldThrowErrorIfKeyIsInvalid (nativeHasProperty) {
20
20
  assert.throws(() => {
21
21
  nativeHasProperty(undefined, 'test');
22
22
  }, /Cannot convert undefined or null to object/);
23
23
  }
24
24
 
25
25
  const objectWithInt32Key = { 12: 101 };
26
- assert.strictEqual(binding.object.hasPropertyWithUint32(objectWithInt32Key,12),true);
26
+ assert.strictEqual(binding.object.hasPropertyWithUint32(objectWithInt32Key, 12), true);
27
27
 
28
28
  testHasProperty(binding.object.hasPropertyWithNapiValue);
29
29
  testHasProperty(binding.object.hasPropertyWithNapiWrapperValue);
@@ -56,11 +56,11 @@ struct UserDataHolder {
56
56
  };
57
57
 
58
58
  Value TestGetter(const CallbackInfo& info) {
59
- return Boolean::New(info.Env(), testValue);
59
+ return Boolean::New(info.Env(), testValue);
60
60
  }
61
61
 
62
62
  void TestSetter(const CallbackInfo& info) {
63
- testValue = info[0].As<Boolean>();
63
+ testValue = info[0].As<Boolean>();
64
64
  }
65
65
 
66
66
  Value TestGetterWithUserData(const CallbackInfo& info) {
@@ -74,7 +74,7 @@ void TestSetterWithUserData(const CallbackInfo& info) {
74
74
  }
75
75
 
76
76
  Value TestFunction(const CallbackInfo& info) {
77
- return Boolean::New(info.Env(), true);
77
+ return Boolean::New(info.Env(), true);
78
78
  }
79
79
 
80
80
  Value TestFunctionWithUserData(const CallbackInfo& info) {
@@ -112,36 +112,56 @@ void DefineProperties(const CallbackInfo& info) {
112
112
 
113
113
  if (nameType.Utf8Value() == "literal") {
114
114
  obj.DefineProperties({
115
- PropertyDescriptor::Accessor(env, obj, "readonlyAccessor", TestGetter),
116
- PropertyDescriptor::Accessor(env, obj, "readwriteAccessor", TestGetter, TestSetter),
117
- PropertyDescriptor::Accessor(env, obj, "readonlyAccessorWithUserData", TestGetterWithUserData, napi_property_attributes::napi_default, reinterpret_cast<void*>(holder)),
118
- PropertyDescriptor::Accessor(env, obj, "readwriteAccessorWithUserData", TestGetterWithUserData, TestSetterWithUserData, napi_property_attributes::napi_default, reinterpret_cast<void*>(holder)),
119
-
120
- PropertyDescriptor::Accessor<TestGetter>("readonlyAccessorT"),
121
- PropertyDescriptor::Accessor<TestGetter, TestSetter>(
122
- "readwriteAccessorT"),
123
- PropertyDescriptor::Accessor<TestGetterWithUserData>(
124
- "readonlyAccessorWithUserDataT",
125
- napi_property_attributes::napi_default,
126
- reinterpret_cast<void*>(holder)),
127
- PropertyDescriptor::Accessor<
128
- TestGetterWithUserData,
129
- TestSetterWithUserData>("readwriteAccessorWithUserDataT",
130
- napi_property_attributes::napi_default,
131
- reinterpret_cast<void*>(holder)),
132
-
133
- PropertyDescriptor::Value("readonlyValue", trueValue),
134
- PropertyDescriptor::Value("readwriteValue", trueValue, napi_writable),
135
- PropertyDescriptor::Value("enumerableValue", trueValue, napi_enumerable),
136
- PropertyDescriptor::Value("configurableValue", trueValue, napi_configurable),
137
- PropertyDescriptor::Function(env, obj, "function", TestFunction),
138
- PropertyDescriptor::Function(env, obj, "functionWithUserData", TestFunctionWithUserData, napi_property_attributes::napi_default, reinterpret_cast<void*>(holder)),
115
+ PropertyDescriptor::Accessor(env, obj, "readonlyAccessor", TestGetter),
116
+ PropertyDescriptor::Accessor(
117
+ env, obj, "readwriteAccessor", TestGetter, TestSetter),
118
+ PropertyDescriptor::Accessor(env,
119
+ obj,
120
+ "readonlyAccessorWithUserData",
121
+ TestGetterWithUserData,
122
+ napi_property_attributes::napi_default,
123
+ reinterpret_cast<void*>(holder)),
124
+ PropertyDescriptor::Accessor(env,
125
+ obj,
126
+ "readwriteAccessorWithUserData",
127
+ TestGetterWithUserData,
128
+ TestSetterWithUserData,
129
+ napi_property_attributes::napi_default,
130
+ reinterpret_cast<void*>(holder)),
131
+
132
+ PropertyDescriptor::Accessor<TestGetter>("readonlyAccessorT"),
133
+ PropertyDescriptor::Accessor<TestGetter, TestSetter>(
134
+ "readwriteAccessorT"),
135
+ PropertyDescriptor::Accessor<TestGetterWithUserData>(
136
+ "readonlyAccessorWithUserDataT",
137
+ napi_property_attributes::napi_default,
138
+ reinterpret_cast<void*>(holder)),
139
+ PropertyDescriptor::Accessor<TestGetterWithUserData,
140
+ TestSetterWithUserData>(
141
+ "readwriteAccessorWithUserDataT",
142
+ napi_property_attributes::napi_default,
143
+ reinterpret_cast<void*>(holder)),
144
+
145
+ PropertyDescriptor::Value("readonlyValue", trueValue),
146
+ PropertyDescriptor::Value("readwriteValue", trueValue, napi_writable),
147
+ PropertyDescriptor::Value(
148
+ "enumerableValue", trueValue, napi_enumerable),
149
+ PropertyDescriptor::Value(
150
+ "configurableValue", trueValue, napi_configurable),
151
+ PropertyDescriptor::Function(env, obj, "function", TestFunction),
152
+ PropertyDescriptor::Function(env,
153
+ obj,
154
+ "functionWithUserData",
155
+ TestFunctionWithUserData,
156
+ napi_property_attributes::napi_default,
157
+ reinterpret_cast<void*>(holder)),
139
158
  });
140
159
  } else if (nameType.Utf8Value() == "string") {
141
- // VS2013 has lifetime issues when passing temporary objects into the constructor of another
142
- // object. It generates code to destruct the object as soon as the constructor call returns.
143
- // Since this isn't a common case for using std::string objects, I'm refactoring the test to
144
- // work around the issue.
160
+ // VS2013 has lifetime issues when passing temporary objects into the
161
+ // constructor of another object. It generates code to destruct the object
162
+ // as soon as the constructor call returns. Since this isn't a common case
163
+ // for using std::string objects, I'm refactoring the test to work around
164
+ // the issue.
145
165
  std::string str1("readonlyAccessor");
146
166
  std::string str2("readwriteAccessor");
147
167
  std::string str1a("readonlyAccessorWithUserData");
@@ -160,66 +180,105 @@ void DefineProperties(const CallbackInfo& info) {
160
180
  std::string str8("functionWithUserData");
161
181
 
162
182
  obj.DefineProperties({
163
- PropertyDescriptor::Accessor(env, obj, str1, TestGetter),
164
- PropertyDescriptor::Accessor(env, obj, str2, TestGetter, TestSetter),
165
- PropertyDescriptor::Accessor(env, obj, str1a, TestGetterWithUserData, napi_property_attributes::napi_default, reinterpret_cast<void*>(holder)),
166
- PropertyDescriptor::Accessor(env, obj, str2a, TestGetterWithUserData, TestSetterWithUserData, napi_property_attributes::napi_default, reinterpret_cast<void*>(holder)),
167
-
168
- PropertyDescriptor::Accessor<TestGetter>(str1t),
169
- PropertyDescriptor::Accessor<TestGetter, TestSetter>(str2t),
170
- PropertyDescriptor::Accessor<TestGetterWithUserData>(str1at,
171
- napi_property_attributes::napi_default,
172
- reinterpret_cast<void*>(holder)),
173
- PropertyDescriptor::Accessor<
174
- TestGetterWithUserData,
175
- TestSetterWithUserData>(str2at,
176
- napi_property_attributes::napi_default,
177
- reinterpret_cast<void*>(holder)),
178
-
179
- PropertyDescriptor::Value(str3, trueValue),
180
- PropertyDescriptor::Value(str4, trueValue, napi_writable),
181
- PropertyDescriptor::Value(str5, trueValue, napi_enumerable),
182
- PropertyDescriptor::Value(str6, trueValue, napi_configurable),
183
- PropertyDescriptor::Function(env, obj, str7, TestFunction),
184
- PropertyDescriptor::Function(env, obj, str8, TestFunctionWithUserData, napi_property_attributes::napi_default, reinterpret_cast<void*>(holder)),
183
+ PropertyDescriptor::Accessor(env, obj, str1, TestGetter),
184
+ PropertyDescriptor::Accessor(env, obj, str2, TestGetter, TestSetter),
185
+ PropertyDescriptor::Accessor(env,
186
+ obj,
187
+ str1a,
188
+ TestGetterWithUserData,
189
+ napi_property_attributes::napi_default,
190
+ reinterpret_cast<void*>(holder)),
191
+ PropertyDescriptor::Accessor(env,
192
+ obj,
193
+ str2a,
194
+ TestGetterWithUserData,
195
+ TestSetterWithUserData,
196
+ napi_property_attributes::napi_default,
197
+ reinterpret_cast<void*>(holder)),
198
+
199
+ PropertyDescriptor::Accessor<TestGetter>(str1t),
200
+ PropertyDescriptor::Accessor<TestGetter, TestSetter>(str2t),
201
+ PropertyDescriptor::Accessor<TestGetterWithUserData>(
202
+ str1at,
203
+ napi_property_attributes::napi_default,
204
+ reinterpret_cast<void*>(holder)),
205
+ PropertyDescriptor::Accessor<TestGetterWithUserData,
206
+ TestSetterWithUserData>(
207
+ str2at,
208
+ napi_property_attributes::napi_default,
209
+ reinterpret_cast<void*>(holder)),
210
+
211
+ PropertyDescriptor::Value(str3, trueValue),
212
+ PropertyDescriptor::Value(str4, trueValue, napi_writable),
213
+ PropertyDescriptor::Value(str5, trueValue, napi_enumerable),
214
+ PropertyDescriptor::Value(str6, trueValue, napi_configurable),
215
+ PropertyDescriptor::Function(env, obj, str7, TestFunction),
216
+ PropertyDescriptor::Function(env,
217
+ obj,
218
+ str8,
219
+ TestFunctionWithUserData,
220
+ napi_property_attributes::napi_default,
221
+ reinterpret_cast<void*>(holder)),
185
222
  });
186
223
  } else if (nameType.Utf8Value() == "value") {
187
224
  obj.DefineProperties({
188
- PropertyDescriptor::Accessor(env, obj,
189
- Napi::String::New(env, "readonlyAccessor"), TestGetter),
190
- PropertyDescriptor::Accessor(env, obj,
191
- Napi::String::New(env, "readwriteAccessor"), TestGetter, TestSetter),
192
- PropertyDescriptor::Accessor(env, obj,
193
- Napi::String::New(env, "readonlyAccessorWithUserData"), TestGetterWithUserData, napi_property_attributes::napi_default, reinterpret_cast<void*>(holder)),
194
- PropertyDescriptor::Accessor(env, obj,
195
- Napi::String::New(env, "readwriteAccessorWithUserData"), TestGetterWithUserData, TestSetterWithUserData, napi_property_attributes::napi_default, reinterpret_cast<void*>(holder)),
196
-
197
- PropertyDescriptor::Accessor<TestGetter>(
198
- Napi::String::New(env, "readonlyAccessorT")),
199
- PropertyDescriptor::Accessor<TestGetter, TestSetter>(
200
- Napi::String::New(env, "readwriteAccessorT")),
201
- PropertyDescriptor::Accessor<TestGetterWithUserData>(
202
- Napi::String::New(env, "readonlyAccessorWithUserDataT"),
203
- napi_property_attributes::napi_default,
204
- reinterpret_cast<void*>(holder)),
205
- PropertyDescriptor::Accessor<
206
- TestGetterWithUserData, TestSetterWithUserData>(
207
- Napi::String::New(env, "readwriteAccessorWithUserDataT"),
208
- napi_property_attributes::napi_default,
209
- reinterpret_cast<void*>(holder)),
210
-
211
- PropertyDescriptor::Value(
212
- Napi::String::New(env, "readonlyValue"), trueValue),
213
- PropertyDescriptor::Value(
214
- Napi::String::New(env, "readwriteValue"), trueValue, napi_writable),
215
- PropertyDescriptor::Value(
216
- Napi::String::New(env, "enumerableValue"), trueValue, napi_enumerable),
217
- PropertyDescriptor::Value(
218
- Napi::String::New(env, "configurableValue"), trueValue, napi_configurable),
219
- PropertyDescriptor::Function(env, obj,
220
- Napi::String::New(env, "function"), TestFunction),
221
- PropertyDescriptor::Function(env, obj,
222
- Napi::String::New(env, "functionWithUserData"), TestFunctionWithUserData, napi_property_attributes::napi_default, reinterpret_cast<void*>(holder)),
225
+ PropertyDescriptor::Accessor(
226
+ env, obj, Napi::String::New(env, "readonlyAccessor"), TestGetter),
227
+ PropertyDescriptor::Accessor(
228
+ env,
229
+ obj,
230
+ Napi::String::New(env, "readwriteAccessor"),
231
+ TestGetter,
232
+ TestSetter),
233
+ PropertyDescriptor::Accessor(
234
+ env,
235
+ obj,
236
+ Napi::String::New(env, "readonlyAccessorWithUserData"),
237
+ TestGetterWithUserData,
238
+ napi_property_attributes::napi_default,
239
+ reinterpret_cast<void*>(holder)),
240
+ PropertyDescriptor::Accessor(
241
+ env,
242
+ obj,
243
+ Napi::String::New(env, "readwriteAccessorWithUserData"),
244
+ TestGetterWithUserData,
245
+ TestSetterWithUserData,
246
+ napi_property_attributes::napi_default,
247
+ reinterpret_cast<void*>(holder)),
248
+
249
+ PropertyDescriptor::Accessor<TestGetter>(
250
+ Napi::String::New(env, "readonlyAccessorT")),
251
+ PropertyDescriptor::Accessor<TestGetter, TestSetter>(
252
+ Napi::String::New(env, "readwriteAccessorT")),
253
+ PropertyDescriptor::Accessor<TestGetterWithUserData>(
254
+ Napi::String::New(env, "readonlyAccessorWithUserDataT"),
255
+ napi_property_attributes::napi_default,
256
+ reinterpret_cast<void*>(holder)),
257
+ PropertyDescriptor::Accessor<TestGetterWithUserData,
258
+ TestSetterWithUserData>(
259
+ Napi::String::New(env, "readwriteAccessorWithUserDataT"),
260
+ napi_property_attributes::napi_default,
261
+ reinterpret_cast<void*>(holder)),
262
+
263
+ PropertyDescriptor::Value(Napi::String::New(env, "readonlyValue"),
264
+ trueValue),
265
+ PropertyDescriptor::Value(
266
+ Napi::String::New(env, "readwriteValue"), trueValue, napi_writable),
267
+ PropertyDescriptor::Value(Napi::String::New(env, "enumerableValue"),
268
+ trueValue,
269
+ napi_enumerable),
270
+ PropertyDescriptor::Value(Napi::String::New(env, "configurableValue"),
271
+ trueValue,
272
+ napi_configurable),
273
+ PropertyDescriptor::Function(
274
+ env, obj, Napi::String::New(env, "function"), TestFunction),
275
+ PropertyDescriptor::Function(
276
+ env,
277
+ obj,
278
+ Napi::String::New(env, "functionWithUserData"),
279
+ TestFunctionWithUserData,
280
+ napi_property_attributes::napi_default,
281
+ reinterpret_cast<void*>(holder)),
223
282
  });
224
283
  }
225
284
  }
@@ -295,36 +354,57 @@ Object InitObject(Env env) {
295
354
  exports["defineValueProperty"] = Function::New(env, DefineValueProperty);
296
355
 
297
356
  exports["getPropertyWithUint32"] = Function::New(env, GetPropertyWithUint32);
298
- exports["getPropertyWithNapiValue"] = Function::New(env, GetPropertyWithNapiValue);
299
- exports["getPropertyWithNapiWrapperValue"] = Function::New(env, GetPropertyWithNapiWrapperValue);
300
- exports["getPropertyWithCStyleString"] = Function::New(env, GetPropertyWithCStyleString);
301
- exports["getPropertyWithCppStyleString"] = Function::New(env, GetPropertyWithCppStyleString);
357
+ exports["getPropertyWithNapiValue"] =
358
+ Function::New(env, GetPropertyWithNapiValue);
359
+ exports["getPropertyWithNapiWrapperValue"] =
360
+ Function::New(env, GetPropertyWithNapiWrapperValue);
361
+ exports["getPropertyWithCStyleString"] =
362
+ Function::New(env, GetPropertyWithCStyleString);
363
+ exports["getPropertyWithCppStyleString"] =
364
+ Function::New(env, GetPropertyWithCppStyleString);
302
365
 
303
366
  exports["setPropertyWithUint32"] = Function::New(env, SetPropertyWithUint32);
304
- exports["setPropertyWithNapiValue"] = Function::New(env, SetPropertyWithNapiValue);
305
- exports["setPropertyWithNapiWrapperValue"] = Function::New(env, SetPropertyWithNapiWrapperValue);
306
- exports["setPropertyWithCStyleString"] = Function::New(env, SetPropertyWithCStyleString);
307
- exports["setPropertyWithCppStyleString"] = Function::New(env, SetPropertyWithCppStyleString);
367
+ exports["setPropertyWithNapiValue"] =
368
+ Function::New(env, SetPropertyWithNapiValue);
369
+ exports["setPropertyWithNapiWrapperValue"] =
370
+ Function::New(env, SetPropertyWithNapiWrapperValue);
371
+ exports["setPropertyWithCStyleString"] =
372
+ Function::New(env, SetPropertyWithCStyleString);
373
+ exports["setPropertyWithCppStyleString"] =
374
+ Function::New(env, SetPropertyWithCppStyleString);
308
375
 
309
376
  exports["deletePropertyWithUint32"] =
310
377
  Function::New(env, DeletePropertyWithUint32);
311
- exports["deletePropertyWithNapiValue"] = Function::New(env, DeletePropertyWithNapiValue);
312
- exports["deletePropertyWithNapiWrapperValue"] = Function::New(env, DeletePropertyWithNapiWrapperValue);
313
- exports["deletePropertyWithCStyleString"] = Function::New(env, DeletePropertyWithCStyleString);
314
- exports["deletePropertyWithCppStyleString"] = Function::New(env, DeletePropertyWithCppStyleString);
315
-
316
- exports["hasOwnPropertyWithNapiValue"] = Function::New(env, HasOwnPropertyWithNapiValue);
317
- exports["hasOwnPropertyWithNapiWrapperValue"] = Function::New(env, HasOwnPropertyWithNapiWrapperValue);
318
- exports["hasOwnPropertyWithCStyleString"] = Function::New(env, HasOwnPropertyWithCStyleString);
319
- exports["hasOwnPropertyWithCppStyleString"] = Function::New(env, HasOwnPropertyWithCppStyleString);
378
+ exports["deletePropertyWithNapiValue"] =
379
+ Function::New(env, DeletePropertyWithNapiValue);
380
+ exports["deletePropertyWithNapiWrapperValue"] =
381
+ Function::New(env, DeletePropertyWithNapiWrapperValue);
382
+ exports["deletePropertyWithCStyleString"] =
383
+ Function::New(env, DeletePropertyWithCStyleString);
384
+ exports["deletePropertyWithCppStyleString"] =
385
+ Function::New(env, DeletePropertyWithCppStyleString);
386
+
387
+ exports["hasOwnPropertyWithNapiValue"] =
388
+ Function::New(env, HasOwnPropertyWithNapiValue);
389
+ exports["hasOwnPropertyWithNapiWrapperValue"] =
390
+ Function::New(env, HasOwnPropertyWithNapiWrapperValue);
391
+ exports["hasOwnPropertyWithCStyleString"] =
392
+ Function::New(env, HasOwnPropertyWithCStyleString);
393
+ exports["hasOwnPropertyWithCppStyleString"] =
394
+ Function::New(env, HasOwnPropertyWithCppStyleString);
320
395
 
321
396
  exports["hasPropertyWithUint32"] = Function::New(env, HasPropertyWithUint32);
322
- exports["hasPropertyWithNapiValue"] = Function::New(env, HasPropertyWithNapiValue);
323
- exports["hasPropertyWithNapiWrapperValue"] = Function::New(env, HasPropertyWithNapiWrapperValue);
324
- exports["hasPropertyWithCStyleString"] = Function::New(env, HasPropertyWithCStyleString);
325
- exports["hasPropertyWithCppStyleString"] = Function::New(env, HasPropertyWithCppStyleString);
326
-
327
- exports["createObjectUsingMagic"] = Function::New(env, CreateObjectUsingMagic);
397
+ exports["hasPropertyWithNapiValue"] =
398
+ Function::New(env, HasPropertyWithNapiValue);
399
+ exports["hasPropertyWithNapiWrapperValue"] =
400
+ Function::New(env, HasPropertyWithNapiWrapperValue);
401
+ exports["hasPropertyWithCStyleString"] =
402
+ Function::New(env, HasPropertyWithCStyleString);
403
+ exports["hasPropertyWithCppStyleString"] =
404
+ Function::New(env, HasPropertyWithCppStyleString);
405
+
406
+ exports["createObjectUsingMagic"] =
407
+ Function::New(env, CreateObjectUsingMagic);
328
408
  #ifdef NAPI_CPP_EXCEPTIONS
329
409
  exports["sum"] = Function::New(env, Sum);
330
410
  exports["increment"] = Function::New(env, Increment);
@@ -4,20 +4,20 @@ const assert = require('assert');
4
4
 
5
5
  module.exports = require('../common').runTest(test);
6
6
 
7
- function test(binding) {
8
- function assertPropertyIs(obj, key, attribute) {
7
+ function test (binding) {
8
+ function assertPropertyIs (obj, key, attribute) {
9
9
  const propDesc = Object.getOwnPropertyDescriptor(obj, key);
10
10
  assert.ok(propDesc);
11
11
  assert.ok(propDesc[attribute]);
12
12
  }
13
13
 
14
- function assertPropertyIsNot(obj, key, attribute) {
14
+ function assertPropertyIsNot (obj, key, attribute) {
15
15
  const propDesc = Object.getOwnPropertyDescriptor(obj, key);
16
16
  assert.ok(propDesc);
17
17
  assert.ok(!propDesc[attribute]);
18
18
  }
19
19
 
20
- function testDefineProperties(nameType) {
20
+ function testDefineProperties (nameType) {
21
21
  const obj = {};
22
22
  binding.object.defineProperties(obj, nameType);
23
23
 
@@ -101,28 +101,29 @@ function test(binding) {
101
101
  testDefineProperties('string');
102
102
  testDefineProperties('value');
103
103
 
104
+ // eslint-disable-next-line no-lone-blocks
104
105
  {
105
106
  assert.strictEqual(binding.object.emptyConstructor(true), true);
106
107
  assert.strictEqual(binding.object.emptyConstructor(false), false);
107
108
  }
108
109
 
109
110
  {
110
- const expected = { 'one': 1, 'two': 2, 'three': 3 };
111
+ const expected = { one: 1, two: 2, three: 3 };
111
112
  const actual = binding.object.constructorFromObject(expected);
112
113
  assert.deepStrictEqual(actual, expected);
113
114
  }
114
115
 
115
116
  {
116
117
  const obj = {};
117
- const testSym = Symbol();
118
+ const testSym = Symbol('testSym');
118
119
  binding.object.defineValueProperty(obj, testSym, 1);
119
120
  assert.strictEqual(obj[testSym], 1);
120
121
  }
121
122
 
122
123
  {
123
- const testSym = Symbol();
124
- const obj = { 'one': 1, 'two': 2, 'three': 3, [testSym]: 4 };
125
- var arr = binding.object.GetPropertyNames(obj);
124
+ const testSym = Symbol('testSym');
125
+ const obj = { one: 1, two: 2, three: 3, [testSym]: 4 };
126
+ const arr = binding.object.GetPropertyNames(obj);
126
127
  assert.deepStrictEqual(arr, ['one', 'two', 'three']);
127
128
  }
128
129
 
@@ -149,7 +150,7 @@ function test(binding) {
149
150
  }
150
151
 
151
152
  {
152
- function Ctor() {};
153
+ function Ctor () {}
153
154
 
154
155
  assert.strictEqual(binding.object.instanceOf(new Ctor(), Ctor), true);
155
156
  assert.strictEqual(binding.object.instanceOf(new Ctor(), Object), true);
@@ -158,60 +159,60 @@ function test(binding) {
158
159
  }
159
160
 
160
161
  if ('sum' in binding.object) {
161
- {
162
- const obj = {
163
- '-forbid': -0x4B1D,
164
- '-feedcode': -0xFEEDC0DE,
165
- '+office': +0x0FF1CE,
166
- '+forbid': +0x4B1D,
167
- '+deadbeef': +0xDEADBEEF,
168
- '+feedcode': +0xFEEDC0DE,
169
- };
170
-
171
- let sum = 0;
172
- for (const key in obj) {
173
- sum += obj[key];
174
- }
175
-
176
- assert.strictEqual(binding.object.sum(obj), sum);
162
+ {
163
+ const obj = {
164
+ '-forbid': -0x4B1D,
165
+ '-feedcode': -0xFEEDC0DE,
166
+ '+office': +0x0FF1CE,
167
+ '+forbid': +0x4B1D,
168
+ '+deadbeef': +0xDEADBEEF,
169
+ '+feedcode': +0xFEEDC0DE
170
+ };
171
+
172
+ let sum = 0;
173
+ for (const key in obj) {
174
+ sum += obj[key];
177
175
  }
178
176
 
179
- {
180
- const obj = new Proxy({
181
- '-forbid': -0x4B1D,
182
- '-feedcode': -0xFEEDC0DE,
183
- '+office': +0x0FF1CE,
184
- '+forbid': +0x4B1D,
185
- '+deadbeef': +0xDEADBEEF,
186
- '+feedcode': +0xFEEDC0DE,
187
- }, {
188
- getOwnPropertyDescriptor(target, p) {
189
- throw new Error("getOwnPropertyDescriptor error");
190
- },
191
- ownKeys(target) {
192
- throw new Error("ownKeys error");
193
- },
194
- });
195
-
196
- assert.throws(() => {
197
- binding.object.sum(obj);
198
- }, /ownKeys error/);
177
+ assert.strictEqual(binding.object.sum(obj), sum);
178
+ }
179
+
180
+ {
181
+ const obj = new Proxy({
182
+ '-forbid': -0x4B1D,
183
+ '-feedcode': -0xFEEDC0DE,
184
+ '+office': +0x0FF1CE,
185
+ '+forbid': +0x4B1D,
186
+ '+deadbeef': +0xDEADBEEF,
187
+ '+feedcode': +0xFEEDC0DE
188
+ }, {
189
+ getOwnPropertyDescriptor (target, p) {
190
+ throw new Error('getOwnPropertyDescriptor error');
191
+ },
192
+ ownKeys (target) {
193
+ throw new Error('ownKeys error');
194
+ }
195
+ });
196
+
197
+ assert.throws(() => {
198
+ binding.object.sum(obj);
199
+ }, /ownKeys error/);
199
200
  }
200
201
  }
201
202
 
202
203
  if ('increment' in binding.object) {
203
204
  const obj = {
204
- 'a': 0,
205
- 'b': 1,
206
- 'c': 2,
205
+ a: 0,
206
+ b: 1,
207
+ c: 2
207
208
  };
208
209
 
209
210
  binding.object.increment(obj);
210
211
 
211
212
  assert.deepStrictEqual(obj, {
212
- 'a': 1,
213
- 'b': 2,
214
- 'c': 3,
213
+ a: 1,
214
+ b: 2,
215
+ c: 3
215
216
  });
216
217
  }
217
218
  }
@@ -7,15 +7,15 @@ static bool testValue = true;
7
7
  namespace {
8
8
 
9
9
  Value TestGetter(const CallbackInfo& info) {
10
- return Boolean::New(info.Env(), testValue);
10
+ return Boolean::New(info.Env(), testValue);
11
11
  }
12
12
 
13
13
  void TestSetter(const CallbackInfo& info) {
14
- testValue = info[0].As<Boolean>();
14
+ testValue = info[0].As<Boolean>();
15
15
  }
16
16
 
17
17
  Value TestFunction(const CallbackInfo& info) {
18
- return Boolean::New(info.Env(), true);
18
+ return Boolean::New(info.Env(), true);
19
19
  }
20
20
 
21
21
  void DefineProperties(const CallbackInfo& info) {
@@ -25,37 +25,41 @@ void DefineProperties(const CallbackInfo& info) {
25
25
 
26
26
  if (nameType.Utf8Value() == "literal") {
27
27
  obj.DefineProperties({
28
- PropertyDescriptor::Accessor("readonlyAccessor", TestGetter),
29
- PropertyDescriptor::Accessor("readwriteAccessor", TestGetter, TestSetter),
30
- PropertyDescriptor::Function("function", TestFunction),
28
+ PropertyDescriptor::Accessor("readonlyAccessor", TestGetter),
29
+ PropertyDescriptor::Accessor(
30
+ "readwriteAccessor", TestGetter, TestSetter),
31
+ PropertyDescriptor::Function("function", TestFunction),
31
32
  });
32
33
  } else if (nameType.Utf8Value() == "string") {
33
- // VS2013 has lifetime issues when passing temporary objects into the constructor of another
34
- // object. It generates code to destruct the object as soon as the constructor call returns.
35
- // Since this isn't a common case for using std::string objects, I'm refactoring the test to
36
- // work around the issue.
34
+ // VS2013 has lifetime issues when passing temporary objects into the
35
+ // constructor of another object. It generates code to destruct the object
36
+ // as soon as the constructor call returns. Since this isn't a common case
37
+ // for using std::string objects, I'm refactoring the test to work around
38
+ // the issue.
37
39
  std::string str1("readonlyAccessor");
38
40
  std::string str2("readwriteAccessor");
39
41
  std::string str7("function");
40
42
 
41
43
  obj.DefineProperties({
42
- PropertyDescriptor::Accessor(str1, TestGetter),
43
- PropertyDescriptor::Accessor(str2, TestGetter, TestSetter),
44
- PropertyDescriptor::Function(str7, TestFunction),
44
+ PropertyDescriptor::Accessor(str1, TestGetter),
45
+ PropertyDescriptor::Accessor(str2, TestGetter, TestSetter),
46
+ PropertyDescriptor::Function(str7, TestFunction),
45
47
  });
46
48
  } else if (nameType.Utf8Value() == "value") {
47
49
  obj.DefineProperties({
48
- PropertyDescriptor::Accessor(
49
- Napi::String::New(env, "readonlyAccessor"), TestGetter),
50
- PropertyDescriptor::Accessor(
51
- Napi::String::New(env, "readwriteAccessor"), TestGetter, TestSetter),
52
- PropertyDescriptor::Function(
53
- Napi::String::New(env, "function"), TestFunction),
50
+ PropertyDescriptor::Accessor(Napi::String::New(env, "readonlyAccessor"),
51
+ TestGetter),
52
+ PropertyDescriptor::Accessor(
53
+ Napi::String::New(env, "readwriteAccessor"),
54
+ TestGetter,
55
+ TestSetter),
56
+ PropertyDescriptor::Function(Napi::String::New(env, "function"),
57
+ TestFunction),
54
58
  });
55
59
  }
56
60
  }
57
61
 
58
- } // end of anonymous namespace
62
+ } // end of anonymous namespace
59
63
 
60
64
  Object InitObjectDeprecated(Env env) {
61
65
  Object exports = Object::New(env);