nan_callbacks_12_inl.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. /*********************************************************************
  2. * NAN - Native Abstractions for Node.js
  3. *
  4. * Copyright (c) 2018 NAN contributors
  5. *
  6. * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
  7. ********************************************************************/
  8. #ifndef NAN_CALLBACKS_12_INL_H_
  9. #define NAN_CALLBACKS_12_INL_H_
  10. template<typename T>
  11. class ReturnValue {
  12. v8::ReturnValue<T> value_;
  13. public:
  14. template <class S>
  15. explicit inline ReturnValue(const v8::ReturnValue<S> &value) :
  16. value_(value) {}
  17. template <class S>
  18. explicit inline ReturnValue(const ReturnValue<S>& that)
  19. : value_(that.value_) {
  20. TYPE_CHECK(T, S);
  21. }
  22. // Handle setters
  23. template <typename S> inline void Set(const v8::Local<S> &handle) {
  24. TYPE_CHECK(T, S);
  25. value_.Set(handle);
  26. }
  27. template <typename S> inline void Set(const Global<S> &handle) {
  28. TYPE_CHECK(T, S);
  29. #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
  30. (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && \
  31. (V8_MINOR_VERSION > 5 || (V8_MINOR_VERSION == 5 && \
  32. defined(V8_BUILD_NUMBER) && V8_BUILD_NUMBER >= 8))))
  33. value_.Set(handle);
  34. #else
  35. value_.Set(*reinterpret_cast<const v8::Persistent<S>*>(&handle));
  36. const_cast<Global<S> &>(handle).Reset();
  37. #endif
  38. }
  39. // Fast primitive setters
  40. inline void Set(bool value) {
  41. TYPE_CHECK(T, v8::Boolean);
  42. value_.Set(value);
  43. }
  44. inline void Set(double i) {
  45. TYPE_CHECK(T, v8::Number);
  46. value_.Set(i);
  47. }
  48. inline void Set(int32_t i) {
  49. TYPE_CHECK(T, v8::Integer);
  50. value_.Set(i);
  51. }
  52. inline void Set(uint32_t i) {
  53. TYPE_CHECK(T, v8::Integer);
  54. value_.Set(i);
  55. }
  56. // Fast JS primitive setters
  57. inline void SetNull() {
  58. TYPE_CHECK(T, v8::Primitive);
  59. value_.SetNull();
  60. }
  61. inline void SetUndefined() {
  62. TYPE_CHECK(T, v8::Primitive);
  63. value_.SetUndefined();
  64. }
  65. inline void SetEmptyString() {
  66. TYPE_CHECK(T, v8::String);
  67. value_.SetEmptyString();
  68. }
  69. // Convenience getter for isolate
  70. inline v8::Isolate *GetIsolate() const {
  71. return value_.GetIsolate();
  72. }
  73. // Pointer setter: Uncompilable to prevent inadvertent misuse.
  74. template<typename S>
  75. inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); }
  76. };
  77. template<typename T>
  78. class FunctionCallbackInfo {
  79. const v8::FunctionCallbackInfo<T> &info_;
  80. const v8::Local<v8::Value> data_;
  81. public:
  82. explicit inline FunctionCallbackInfo(
  83. const v8::FunctionCallbackInfo<T> &info
  84. , v8::Local<v8::Value> data) :
  85. info_(info)
  86. , data_(data) {}
  87. inline ReturnValue<T> GetReturnValue() const {
  88. return ReturnValue<T>(info_.GetReturnValue());
  89. }
  90. #if NODE_MAJOR_VERSION < 10
  91. inline v8::Local<v8::Function> Callee() const { return info_.Callee(); }
  92. #endif
  93. inline v8::Local<v8::Value> Data() const { return data_; }
  94. inline v8::Local<v8::Object> Holder() const { return info_.Holder(); }
  95. inline bool IsConstructCall() const { return info_.IsConstructCall(); }
  96. inline int Length() const { return info_.Length(); }
  97. inline v8::Local<v8::Value> operator[](int i) const { return info_[i]; }
  98. inline v8::Local<v8::Object> This() const { return info_.This(); }
  99. inline v8::Isolate *GetIsolate() const { return info_.GetIsolate(); }
  100. protected:
  101. static const int kHolderIndex = 0;
  102. static const int kIsolateIndex = 1;
  103. static const int kReturnValueDefaultValueIndex = 2;
  104. static const int kReturnValueIndex = 3;
  105. static const int kDataIndex = 4;
  106. static const int kCalleeIndex = 5;
  107. static const int kContextSaveIndex = 6;
  108. static const int kArgsLength = 7;
  109. private:
  110. NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo)
  111. };
  112. template<typename T>
  113. class PropertyCallbackInfo {
  114. const v8::PropertyCallbackInfo<T> &info_;
  115. const v8::Local<v8::Value> data_;
  116. public:
  117. explicit inline PropertyCallbackInfo(
  118. const v8::PropertyCallbackInfo<T> &info
  119. , const v8::Local<v8::Value> data) :
  120. info_(info)
  121. , data_(data) {}
  122. inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); }
  123. inline v8::Local<v8::Value> Data() const { return data_; }
  124. inline v8::Local<v8::Object> This() const { return info_.This(); }
  125. inline v8::Local<v8::Object> Holder() const { return info_.Holder(); }
  126. inline ReturnValue<T> GetReturnValue() const {
  127. return ReturnValue<T>(info_.GetReturnValue());
  128. }
  129. protected:
  130. static const int kHolderIndex = 0;
  131. static const int kIsolateIndex = 1;
  132. static const int kReturnValueDefaultValueIndex = 2;
  133. static const int kReturnValueIndex = 3;
  134. static const int kDataIndex = 4;
  135. static const int kThisIndex = 5;
  136. static const int kArgsLength = 6;
  137. private:
  138. NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfo)
  139. };
  140. namespace imp {
  141. static
  142. void FunctionCallbackWrapper(const v8::FunctionCallbackInfo<v8::Value> &info) {
  143. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  144. FunctionCallback callback = reinterpret_cast<FunctionCallback>(
  145. reinterpret_cast<intptr_t>(
  146. obj->GetInternalField(kFunctionIndex)
  147. .As<v8::Value>().As<v8::External>()->Value()));
  148. FunctionCallbackInfo<v8::Value>
  149. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  150. callback(cbinfo);
  151. }
  152. typedef void (*NativeFunction)(const v8::FunctionCallbackInfo<v8::Value> &);
  153. #if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
  154. static
  155. void GetterCallbackWrapper(
  156. v8::Local<v8::Name> property
  157. , const v8::PropertyCallbackInfo<v8::Value> &info) {
  158. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  159. PropertyCallbackInfo<v8::Value>
  160. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  161. GetterCallback callback = reinterpret_cast<GetterCallback>(
  162. reinterpret_cast<intptr_t>(
  163. obj->GetInternalField(kGetterIndex)
  164. .As<v8::Value>().As<v8::External>()->Value()));
  165. callback(property.As<v8::String>(), cbinfo);
  166. }
  167. typedef void (*NativeGetter)
  168. (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &);
  169. static
  170. void SetterCallbackWrapper(
  171. v8::Local<v8::Name> property
  172. , v8::Local<v8::Value> value
  173. , const v8::PropertyCallbackInfo<void> &info) {
  174. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  175. PropertyCallbackInfo<void>
  176. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  177. SetterCallback callback = reinterpret_cast<SetterCallback>(
  178. reinterpret_cast<intptr_t>(
  179. obj->GetInternalField(kSetterIndex)
  180. .As<v8::Value>().As<v8::External>()->Value()));
  181. callback(property.As<v8::String>(), value, cbinfo);
  182. }
  183. typedef void (*NativeSetter)(
  184. v8::Local<v8::Name>
  185. , v8::Local<v8::Value>
  186. , const v8::PropertyCallbackInfo<void> &);
  187. #else
  188. static
  189. void GetterCallbackWrapper(
  190. v8::Local<v8::String> property
  191. , const v8::PropertyCallbackInfo<v8::Value> &info) {
  192. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  193. PropertyCallbackInfo<v8::Value>
  194. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  195. GetterCallback callback = reinterpret_cast<GetterCallback>(
  196. reinterpret_cast<intptr_t>(
  197. obj->GetInternalField(kGetterIndex)
  198. .As<v8::Value>().As<v8::External>()->Value()));
  199. callback(property, cbinfo);
  200. }
  201. typedef void (*NativeGetter)
  202. (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value> &);
  203. static
  204. void SetterCallbackWrapper(
  205. v8::Local<v8::String> property
  206. , v8::Local<v8::Value> value
  207. , const v8::PropertyCallbackInfo<void> &info) {
  208. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  209. PropertyCallbackInfo<void>
  210. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  211. SetterCallback callback = reinterpret_cast<SetterCallback>(
  212. reinterpret_cast<intptr_t>(
  213. obj->GetInternalField(kSetterIndex)
  214. .As<v8::Value>().As<v8::External>()->Value()));
  215. callback(property, value, cbinfo);
  216. }
  217. typedef void (*NativeSetter)(
  218. v8::Local<v8::String>
  219. , v8::Local<v8::Value>
  220. , const v8::PropertyCallbackInfo<void> &);
  221. #endif
  222. #if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
  223. static
  224. void PropertyGetterCallbackWrapper(
  225. v8::Local<v8::Name> property
  226. , const v8::PropertyCallbackInfo<v8::Value> &info) {
  227. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  228. PropertyCallbackInfo<v8::Value>
  229. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  230. PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>(
  231. reinterpret_cast<intptr_t>(
  232. obj->GetInternalField(kPropertyGetterIndex)
  233. .As<v8::Value>().As<v8::External>()->Value()));
  234. callback(property.As<v8::String>(), cbinfo);
  235. }
  236. typedef void (*NativePropertyGetter)
  237. (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &);
  238. static
  239. void PropertySetterCallbackWrapper(
  240. v8::Local<v8::Name> property
  241. , v8::Local<v8::Value> value
  242. , const v8::PropertyCallbackInfo<v8::Value> &info) {
  243. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  244. PropertyCallbackInfo<v8::Value>
  245. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  246. PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>(
  247. reinterpret_cast<intptr_t>(
  248. obj->GetInternalField(kPropertySetterIndex)
  249. .As<v8::Value>().As<v8::External>()->Value()));
  250. callback(property.As<v8::String>(), value, cbinfo);
  251. }
  252. typedef void (*NativePropertySetter)(
  253. v8::Local<v8::Name>
  254. , v8::Local<v8::Value>
  255. , const v8::PropertyCallbackInfo<v8::Value> &);
  256. static
  257. void PropertyEnumeratorCallbackWrapper(
  258. const v8::PropertyCallbackInfo<v8::Array> &info) {
  259. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  260. PropertyCallbackInfo<v8::Array>
  261. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  262. PropertyEnumeratorCallback callback =
  263. reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>(
  264. obj->GetInternalField(kPropertyEnumeratorIndex)
  265. .As<v8::Value>().As<v8::External>()->Value()));
  266. callback(cbinfo);
  267. }
  268. typedef void (*NativePropertyEnumerator)
  269. (const v8::PropertyCallbackInfo<v8::Array> &);
  270. static
  271. void PropertyDeleterCallbackWrapper(
  272. v8::Local<v8::Name> property
  273. , const v8::PropertyCallbackInfo<v8::Boolean> &info) {
  274. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  275. PropertyCallbackInfo<v8::Boolean>
  276. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  277. PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>(
  278. reinterpret_cast<intptr_t>(
  279. obj->GetInternalField(kPropertyDeleterIndex)
  280. .As<v8::Value>().As<v8::External>()->Value()));
  281. callback(property.As<v8::String>(), cbinfo);
  282. }
  283. typedef void (NativePropertyDeleter)
  284. (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Boolean> &);
  285. static
  286. void PropertyQueryCallbackWrapper(
  287. v8::Local<v8::Name> property
  288. , const v8::PropertyCallbackInfo<v8::Integer> &info) {
  289. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  290. PropertyCallbackInfo<v8::Integer>
  291. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  292. PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>(
  293. reinterpret_cast<intptr_t>(
  294. obj->GetInternalField(kPropertyQueryIndex)
  295. .As<v8::Value>().As<v8::External>()->Value()));
  296. callback(property.As<v8::String>(), cbinfo);
  297. }
  298. typedef void (*NativePropertyQuery)
  299. (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Integer> &);
  300. #else
  301. static
  302. void PropertyGetterCallbackWrapper(
  303. v8::Local<v8::String> property
  304. , const v8::PropertyCallbackInfo<v8::Value> &info) {
  305. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  306. PropertyCallbackInfo<v8::Value>
  307. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  308. PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>(
  309. reinterpret_cast<intptr_t>(
  310. obj->GetInternalField(kPropertyGetterIndex)
  311. .As<v8::Value>().As<v8::External>()->Value()));
  312. callback(property, cbinfo);
  313. }
  314. typedef void (*NativePropertyGetter)
  315. (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value> &);
  316. static
  317. void PropertySetterCallbackWrapper(
  318. v8::Local<v8::String> property
  319. , v8::Local<v8::Value> value
  320. , const v8::PropertyCallbackInfo<v8::Value> &info) {
  321. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  322. PropertyCallbackInfo<v8::Value>
  323. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  324. PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>(
  325. reinterpret_cast<intptr_t>(
  326. obj->GetInternalField(kPropertySetterIndex)
  327. .As<v8::Value>().As<v8::External>()->Value()));
  328. callback(property, value, cbinfo);
  329. }
  330. typedef void (*NativePropertySetter)(
  331. v8::Local<v8::String>
  332. , v8::Local<v8::Value>
  333. , const v8::PropertyCallbackInfo<v8::Value> &);
  334. static
  335. void PropertyEnumeratorCallbackWrapper(
  336. const v8::PropertyCallbackInfo<v8::Array> &info) {
  337. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  338. PropertyCallbackInfo<v8::Array>
  339. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  340. PropertyEnumeratorCallback callback =
  341. reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>(
  342. obj->GetInternalField(kPropertyEnumeratorIndex)
  343. .As<v8::Value>().As<v8::External>()->Value()));
  344. callback(cbinfo);
  345. }
  346. typedef void (*NativePropertyEnumerator)
  347. (const v8::PropertyCallbackInfo<v8::Array> &);
  348. static
  349. void PropertyDeleterCallbackWrapper(
  350. v8::Local<v8::String> property
  351. , const v8::PropertyCallbackInfo<v8::Boolean> &info) {
  352. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  353. PropertyCallbackInfo<v8::Boolean>
  354. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  355. PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>(
  356. reinterpret_cast<intptr_t>(
  357. obj->GetInternalField(kPropertyDeleterIndex)
  358. .As<v8::Value>().As<v8::External>()->Value()));
  359. callback(property, cbinfo);
  360. }
  361. typedef void (NativePropertyDeleter)
  362. (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Boolean> &);
  363. static
  364. void PropertyQueryCallbackWrapper(
  365. v8::Local<v8::String> property
  366. , const v8::PropertyCallbackInfo<v8::Integer> &info) {
  367. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  368. PropertyCallbackInfo<v8::Integer>
  369. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  370. PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>(
  371. reinterpret_cast<intptr_t>(
  372. obj->GetInternalField(kPropertyQueryIndex)
  373. .As<v8::Value>().As<v8::External>()->Value()));
  374. callback(property, cbinfo);
  375. }
  376. typedef void (*NativePropertyQuery)
  377. (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer> &);
  378. #endif
  379. static
  380. void IndexGetterCallbackWrapper(
  381. uint32_t index, const v8::PropertyCallbackInfo<v8::Value> &info) {
  382. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  383. PropertyCallbackInfo<v8::Value>
  384. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  385. IndexGetterCallback callback = reinterpret_cast<IndexGetterCallback>(
  386. reinterpret_cast<intptr_t>(
  387. obj->GetInternalField(kIndexPropertyGetterIndex)
  388. .As<v8::Value>().As<v8::External>()->Value()));
  389. callback(index, cbinfo);
  390. }
  391. typedef void (*NativeIndexGetter)
  392. (uint32_t, const v8::PropertyCallbackInfo<v8::Value> &);
  393. static
  394. void IndexSetterCallbackWrapper(
  395. uint32_t index
  396. , v8::Local<v8::Value> value
  397. , const v8::PropertyCallbackInfo<v8::Value> &info) {
  398. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  399. PropertyCallbackInfo<v8::Value>
  400. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  401. IndexSetterCallback callback = reinterpret_cast<IndexSetterCallback>(
  402. reinterpret_cast<intptr_t>(
  403. obj->GetInternalField(kIndexPropertySetterIndex)
  404. .As<v8::Value>().As<v8::External>()->Value()));
  405. callback(index, value, cbinfo);
  406. }
  407. typedef void (*NativeIndexSetter)(
  408. uint32_t
  409. , v8::Local<v8::Value>
  410. , const v8::PropertyCallbackInfo<v8::Value> &);
  411. static
  412. void IndexEnumeratorCallbackWrapper(
  413. const v8::PropertyCallbackInfo<v8::Array> &info) {
  414. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  415. PropertyCallbackInfo<v8::Array>
  416. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  417. IndexEnumeratorCallback callback = reinterpret_cast<IndexEnumeratorCallback>(
  418. reinterpret_cast<intptr_t>(
  419. obj->GetInternalField(
  420. kIndexPropertyEnumeratorIndex)
  421. .As<v8::Value>().As<v8::External>()->Value()));
  422. callback(cbinfo);
  423. }
  424. typedef void (*NativeIndexEnumerator)
  425. (const v8::PropertyCallbackInfo<v8::Array> &);
  426. static
  427. void IndexDeleterCallbackWrapper(
  428. uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean> &info) {
  429. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  430. PropertyCallbackInfo<v8::Boolean>
  431. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  432. IndexDeleterCallback callback = reinterpret_cast<IndexDeleterCallback>(
  433. reinterpret_cast<intptr_t>(
  434. obj->GetInternalField(kIndexPropertyDeleterIndex)
  435. .As<v8::Value>().As<v8::External>()->Value()));
  436. callback(index, cbinfo);
  437. }
  438. typedef void (*NativeIndexDeleter)
  439. (uint32_t, const v8::PropertyCallbackInfo<v8::Boolean> &);
  440. static
  441. void IndexQueryCallbackWrapper(
  442. uint32_t index, const v8::PropertyCallbackInfo<v8::Integer> &info) {
  443. v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
  444. PropertyCallbackInfo<v8::Integer>
  445. cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
  446. IndexQueryCallback callback = reinterpret_cast<IndexQueryCallback>(
  447. reinterpret_cast<intptr_t>(
  448. obj->GetInternalField(kIndexPropertyQueryIndex)
  449. .As<v8::Value>().As<v8::External>()->Value()));
  450. callback(index, cbinfo);
  451. }
  452. typedef void (*NativeIndexQuery)
  453. (uint32_t, const v8::PropertyCallbackInfo<v8::Integer> &);
  454. } // end of namespace imp
  455. #endif // NAN_CALLBACKS_12_INL_H_