@crossbind/core-embind-jsi 2.0.0-beta.60 → 2.0.0-beta.63
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.
- package/LICENSE +76 -0
- package/README.md +1 -1
- package/cpp/src/crossbind/direct_reads.h +30 -0
- package/cpp/src/emscripten/bind.cpp +133 -175
- package/cpp/src/emscripten/bind.h +57 -77
- package/cpp/src/emscripten/val.h +57 -146
- package/cpp/src/emscripten/wire.h +169 -47
- package/js/embind.js +128 -774
- package/package.json +9 -1
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
#include <map>
|
|
18
18
|
#include <string>
|
|
19
19
|
#include <type_traits>
|
|
20
|
+
#include <utility>
|
|
20
21
|
#include <vector>
|
|
21
22
|
|
|
22
23
|
#include "./em_macros.h"
|
|
@@ -630,42 +631,21 @@ struct SignatureTranslator<ReturnType (*)(Args...)> { using type = void*; };
|
|
|
630
631
|
#define call_invoke_4 ({return invoke(fn, args[0], args[1], args[2], args[3]);})
|
|
631
632
|
#define call_invoke(count) (call_invoke_##count)
|
|
632
633
|
|
|
634
|
+
namespace internal {
|
|
635
|
+
// Every JS argument of a call, however many parameters the bound function has.
|
|
636
|
+
template<typename Invoke, typename Fn, std::size_t... I>
|
|
637
|
+
EMSCRIPTEN_ALWAYS_INLINE decltype(auto) invokeWithArgs(facebook::jsi::Runtime& rt, Invoke&& invoke, Fn&& fn,
|
|
638
|
+
const facebook::jsi::Value* args, std::index_sequence<I...>) {
|
|
639
|
+
return invoke(rt, std::forward<Fn>(fn), args[I]...);
|
|
640
|
+
}
|
|
641
|
+
} // end namespace internal
|
|
642
|
+
|
|
633
643
|
#define callInvoke(count, invokeVar, fnVar) ({ \
|
|
634
|
-
|
|
635
|
-
else if constexpr (count == 2) { return invokeVar(rt, fnVar, args[0], args[1]); }\
|
|
636
|
-
else if constexpr (count == 3) { return invokeVar(rt, fnVar, args[0], args[1], args[2]); }\
|
|
637
|
-
else if constexpr (count == 4) { return invokeVar(rt, fnVar, args[0], args[1], args[2], args[3]); }\
|
|
638
|
-
else if constexpr (count == 5) { return invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4]); }\
|
|
639
|
-
else if constexpr (count == 6) { return invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5]); }\
|
|
640
|
-
else if constexpr (count == 7) { return invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6]); }\
|
|
641
|
-
else if constexpr (count == 8) { return invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); }\
|
|
642
|
-
else if constexpr (count == 9) { return invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]); }\
|
|
643
|
-
else if constexpr (count == 10) { return invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]); }\
|
|
644
|
-
else if constexpr (count == 11) { return invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10]); }\
|
|
645
|
-
else if constexpr (count == 12) { return invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11]); }\
|
|
646
|
-
else if constexpr (count == 13) { return invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12]); }\
|
|
647
|
-
else if constexpr (count == 14) { return invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13]); }\
|
|
648
|
-
else if constexpr (count == 15) { return invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14]); }\
|
|
649
|
-
else { return invokeVar(rt, fnVar); } \
|
|
644
|
+
return ::emscripten::internal::invokeWithArgs(rt, invokeVar, fnVar, args, std::make_index_sequence<(count)>{}); \
|
|
650
645
|
})
|
|
651
646
|
|
|
652
647
|
#define callInvokeVoid(count, invokeVar, fnVar) ({ \
|
|
653
|
-
|
|
654
|
-
else if constexpr (count == 2) { invokeVar(rt, fnVar, args[0], args[1]); }\
|
|
655
|
-
else if constexpr (count == 3) { invokeVar(rt, fnVar, args[0], args[1], args[2]); }\
|
|
656
|
-
else if constexpr (count == 4) { invokeVar(rt, fnVar, args[0], args[1], args[2], args[3]); }\
|
|
657
|
-
else if constexpr (count == 5) { invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4]); }\
|
|
658
|
-
else if constexpr (count == 6) { invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5]); }\
|
|
659
|
-
else if constexpr (count == 7) { invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6]); }\
|
|
660
|
-
else if constexpr (count == 8) { invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); }\
|
|
661
|
-
else if constexpr (count == 9) { invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]); }\
|
|
662
|
-
else if constexpr (count == 10) { invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]); }\
|
|
663
|
-
else if constexpr (count == 11) { invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10]); }\
|
|
664
|
-
else if constexpr (count == 12) { invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11]); }\
|
|
665
|
-
else if constexpr (count == 13) { invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12]); }\
|
|
666
|
-
else if constexpr (count == 14) { invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13]); }\
|
|
667
|
-
else if constexpr (count == 15) { invokeVar(rt, fnVar, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14]); }\
|
|
668
|
-
else { invokeVar(rt, fnVar); } \
|
|
648
|
+
::emscripten::internal::invokeWithArgs(rt, invokeVar, fnVar, args, std::make_index_sequence<(count)>{}); \
|
|
669
649
|
})
|
|
670
650
|
|
|
671
651
|
template<typename ReturnType, typename... Args, typename... Policies>
|
|
@@ -1183,7 +1163,7 @@ public:
|
|
|
1183
1163
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(name)+"_constructor"),
|
|
1184
1164
|
1,
|
|
1185
1165
|
[destructor](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1186
|
-
ClassType* t = reinterpret_cast<ClassType*>(args[0]
|
|
1166
|
+
ClassType* t = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[0]));
|
|
1187
1167
|
destructor(t);
|
|
1188
1168
|
return facebook::jsi::Value::undefined();
|
|
1189
1169
|
});
|
|
@@ -1216,7 +1196,7 @@ public:
|
|
|
1216
1196
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_array_element_gter1"),
|
|
1217
1197
|
2,
|
|
1218
1198
|
[getter, field](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1219
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1199
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1220
1200
|
return getter(field, *t2);
|
|
1221
1201
|
});
|
|
1222
1202
|
|
|
@@ -1225,7 +1205,7 @@ public:
|
|
|
1225
1205
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_array_element_ster1"),
|
|
1226
1206
|
3,
|
|
1227
1207
|
[setter, field](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1228
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1208
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1229
1209
|
setter(field, *t2, args[2]);
|
|
1230
1210
|
return facebook::jsi::Value::undefined();
|
|
1231
1211
|
});
|
|
@@ -1257,8 +1237,8 @@ public:
|
|
|
1257
1237
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_array_element_gter2"),
|
|
1258
1238
|
2,
|
|
1259
1239
|
[g, getter](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1260
|
-
Getter* t = reinterpret_cast<Getter*>(args[0]
|
|
1261
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1240
|
+
Getter* t = reinterpret_cast<Getter*>(internal::bigIntUint64(rt, args[0]));
|
|
1241
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1262
1242
|
return g(getter, *t2);
|
|
1263
1243
|
});
|
|
1264
1244
|
|
|
@@ -1267,8 +1247,8 @@ public:
|
|
|
1267
1247
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_array_element_ster2"),
|
|
1268
1248
|
3,
|
|
1269
1249
|
[s](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1270
|
-
Setter* t = reinterpret_cast<Setter*>(args[0]
|
|
1271
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1250
|
+
Setter* t = reinterpret_cast<Setter*>(internal::bigIntUint64(rt, args[0]));
|
|
1251
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1272
1252
|
s(*t, *t2, args[2]);
|
|
1273
1253
|
return facebook::jsi::Value::undefined();
|
|
1274
1254
|
});
|
|
@@ -1299,8 +1279,8 @@ public:
|
|
|
1299
1279
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_array_element_gter3"),
|
|
1300
1280
|
2,
|
|
1301
1281
|
[getter](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1302
|
-
int t1 = static_cast<int>(args[0]
|
|
1303
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1282
|
+
int t1 = static_cast<int>(internal::bigIntUint64(rt, args[0]));
|
|
1283
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1304
1284
|
return getter(t1, *t2);
|
|
1305
1285
|
});
|
|
1306
1286
|
|
|
@@ -1310,8 +1290,8 @@ public:
|
|
|
1310
1290
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_array_element_ster3"),
|
|
1311
1291
|
3,
|
|
1312
1292
|
[setter](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1313
|
-
int t1 = static_cast<int>(args[0]
|
|
1314
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1293
|
+
int t1 = static_cast<int>(internal::bigIntUint64(rt, args[0]));
|
|
1294
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1315
1295
|
setter(t1, *t2, args[2]);
|
|
1316
1296
|
return facebook::jsi::Value::undefined();
|
|
1317
1297
|
});
|
|
@@ -1359,7 +1339,7 @@ public:
|
|
|
1359
1339
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(name)+"_constructor"),
|
|
1360
1340
|
1,
|
|
1361
1341
|
[dtor](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1362
|
-
ClassType* t = reinterpret_cast<ClassType*>(args[0]
|
|
1342
|
+
ClassType* t = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[0]));
|
|
1363
1343
|
dtor(t);
|
|
1364
1344
|
return facebook::jsi::Value::undefined();
|
|
1365
1345
|
});
|
|
@@ -1392,7 +1372,7 @@ public:
|
|
|
1392
1372
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_object_element_gter1"),
|
|
1393
1373
|
2,
|
|
1394
1374
|
[getter, field](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1395
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1375
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1396
1376
|
return getter(field, *t2);
|
|
1397
1377
|
});
|
|
1398
1378
|
|
|
@@ -1401,7 +1381,7 @@ public:
|
|
|
1401
1381
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_object_element_ster1"),
|
|
1402
1382
|
3,
|
|
1403
1383
|
[setter, field](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1404
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1384
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1405
1385
|
setter(field, *t2, args[2]);
|
|
1406
1386
|
return facebook::jsi::Value::undefined();
|
|
1407
1387
|
});
|
|
@@ -1439,8 +1419,8 @@ public:
|
|
|
1439
1419
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_object_element_gter1"),
|
|
1440
1420
|
2,
|
|
1441
1421
|
[getter, field](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1442
|
-
const MemberPointer* t1 = reinterpret_cast<MemberPointer*>(args[0]
|
|
1443
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1422
|
+
const MemberPointer* t1 = reinterpret_cast<MemberPointer*>(internal::bigIntUint64(rt, args[0]));
|
|
1423
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1444
1424
|
return getter(*t1, *t2);
|
|
1445
1425
|
});
|
|
1446
1426
|
|
|
@@ -1449,8 +1429,8 @@ public:
|
|
|
1449
1429
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_object_element_ster1"),
|
|
1450
1430
|
3,
|
|
1451
1431
|
[setter, field](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1452
|
-
const MemberPointer* t1 = reinterpret_cast<MemberPointer*>(args[0]
|
|
1453
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1432
|
+
const MemberPointer* t1 = reinterpret_cast<MemberPointer*>(internal::bigIntUint64(rt, args[0]));
|
|
1433
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1454
1434
|
setter(*t1, *t2, args[2]);
|
|
1455
1435
|
return facebook::jsi::Value::undefined();
|
|
1456
1436
|
});
|
|
@@ -1487,8 +1467,8 @@ public:
|
|
|
1487
1467
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_object_element_gter2"),
|
|
1488
1468
|
2,
|
|
1489
1469
|
[g, getter](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1490
|
-
Getter* t = reinterpret_cast<Getter*>(args[0]
|
|
1491
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1470
|
+
Getter* t = reinterpret_cast<Getter*>(internal::bigIntUint64(rt, args[0]));
|
|
1471
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1492
1472
|
return g(getter, *t2);
|
|
1493
1473
|
});
|
|
1494
1474
|
|
|
@@ -1497,8 +1477,8 @@ public:
|
|
|
1497
1477
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_object_element_ster2"),
|
|
1498
1478
|
3,
|
|
1499
1479
|
[s](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1500
|
-
Setter* t = reinterpret_cast<Setter*>(args[0]
|
|
1501
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1480
|
+
Setter* t = reinterpret_cast<Setter*>(internal::bigIntUint64(rt, args[0]));
|
|
1481
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1502
1482
|
s(*t, *t2, args[2]);
|
|
1503
1483
|
return facebook::jsi::Value::undefined();
|
|
1504
1484
|
});
|
|
@@ -1531,8 +1511,8 @@ public:
|
|
|
1531
1511
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_object_element_gter3"),
|
|
1532
1512
|
2,
|
|
1533
1513
|
[getter](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1534
|
-
int t1 = static_cast<int>(args[0]
|
|
1535
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1514
|
+
int t1 = static_cast<int>(internal::bigIntUint64(rt, args[0]));
|
|
1515
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1536
1516
|
return getter(t1, *t2);
|
|
1537
1517
|
});
|
|
1538
1518
|
|
|
@@ -1541,8 +1521,8 @@ public:
|
|
|
1541
1521
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, "value_object_element_ster3"),
|
|
1542
1522
|
3,
|
|
1543
1523
|
[setter](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
1544
|
-
int t1 = static_cast<int>(args[0]
|
|
1545
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
1524
|
+
int t1 = static_cast<int>(internal::bigIntUint64(rt, args[0]));
|
|
1525
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
1546
1526
|
setter(t1, *t2, args[2]);
|
|
1547
1527
|
return facebook::jsi::Value::undefined();
|
|
1548
1528
|
});
|
|
@@ -2159,7 +2139,7 @@ public:
|
|
|
2159
2139
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(name)+"__getActualType"),
|
|
2160
2140
|
1,
|
|
2161
2141
|
[_getActualType](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2162
|
-
auto returnValue = _getActualType(reinterpret_cast<ClassType*>(args[0]
|
|
2142
|
+
auto returnValue = _getActualType(reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[0])));
|
|
2163
2143
|
return facebook::jsi::BigInt::fromUint64(rt, reinterpret_cast<uint64_t>(returnValue));
|
|
2164
2144
|
});
|
|
2165
2145
|
|
|
@@ -2168,7 +2148,7 @@ public:
|
|
|
2168
2148
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(name)+"_upcast"),
|
|
2169
2149
|
1,
|
|
2170
2150
|
[upcast](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2171
|
-
ClassType* t = reinterpret_cast<ClassType*>(args[0]
|
|
2151
|
+
ClassType* t = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[0]));
|
|
2172
2152
|
BaseSpecifier* a = nullptr;
|
|
2173
2153
|
return dsadsa<ClassType, BaseSpecifier>(rt, t, a);
|
|
2174
2154
|
});
|
|
@@ -2178,7 +2158,7 @@ public:
|
|
|
2178
2158
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(name)+"_downcast"),
|
|
2179
2159
|
1,
|
|
2180
2160
|
[downcast](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2181
|
-
ClassType* t = reinterpret_cast<ClassType*>(args[0]
|
|
2161
|
+
ClassType* t = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[0]));
|
|
2182
2162
|
BaseSpecifier* a = nullptr;
|
|
2183
2163
|
return downcastHelper<ClassType, BaseSpecifier>(rt, t, a);
|
|
2184
2164
|
});
|
|
@@ -2188,7 +2168,7 @@ public:
|
|
|
2188
2168
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(name)+"_destructor"),
|
|
2189
2169
|
1,
|
|
2190
2170
|
[destructor](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2191
|
-
destructor(reinterpret_cast<ClassType*>(args[0]
|
|
2171
|
+
destructor(reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[0])));
|
|
2192
2172
|
return facebook::jsi::Value::undefined();
|
|
2193
2173
|
});
|
|
2194
2174
|
|
|
@@ -2227,7 +2207,7 @@ public:
|
|
|
2227
2207
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(name)+"_get"),
|
|
2228
2208
|
1,
|
|
2229
2209
|
[get](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2230
|
-
uint64_t ptrNumber = args[0]
|
|
2210
|
+
uint64_t ptrNumber = internal::bigIntUint64(rt, args[0]);
|
|
2231
2211
|
auto b = *reinterpret_cast<PointerType*>(ptrNumber);
|
|
2232
2212
|
auto a = get(b);
|
|
2233
2213
|
return facebook::jsi::BigInt::fromUint64(rt, reinterpret_cast<uint64_t>(a));
|
|
@@ -2247,10 +2227,10 @@ public:
|
|
|
2247
2227
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(name)+"_share"),
|
|
2248
2228
|
2,
|
|
2249
2229
|
[share](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2250
|
-
uint64_t pNumber = args[0]
|
|
2230
|
+
uint64_t pNumber = internal::bigIntUint64(rt, args[0]);
|
|
2251
2231
|
auto p = reinterpret_cast<PointeeType*>(pNumber);
|
|
2252
2232
|
// uint64_t vNumber = (uint64_t) args[1].getNumber();
|
|
2253
|
-
uint64_t vNumber = args[1]
|
|
2233
|
+
uint64_t vNumber = internal::bigIntUint64(rt, args[1]);
|
|
2254
2234
|
EM_VAL v = reinterpret_cast<EM_VAL>(vNumber);
|
|
2255
2235
|
auto a = share(p, v);
|
|
2256
2236
|
auto e = facebook::jsi::BigInt::fromUint64(rt, reinterpret_cast<uint64_t>(a));
|
|
@@ -2262,7 +2242,7 @@ public:
|
|
|
2262
2242
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(name)+"_destructor"),
|
|
2263
2243
|
1,
|
|
2264
2244
|
[destructor](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2265
|
-
uint64_t ptrNumber = args[0]
|
|
2245
|
+
uint64_t ptrNumber = internal::bigIntUint64(rt, args[0]);
|
|
2266
2246
|
auto b = reinterpret_cast<PointerType*>(ptrNumber);
|
|
2267
2247
|
destructor(b);
|
|
2268
2248
|
return facebook::jsi::Value::undefined();
|
|
@@ -2403,7 +2383,7 @@ public:
|
|
|
2403
2383
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(fieldName)+"_gter"),
|
|
2404
2384
|
2,
|
|
2405
2385
|
[getter, a](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2406
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
2386
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
2407
2387
|
return getter(a, *t2);
|
|
2408
2388
|
});
|
|
2409
2389
|
|
|
@@ -2441,8 +2421,8 @@ public:
|
|
|
2441
2421
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(fieldName)+"_gter"),
|
|
2442
2422
|
2,
|
|
2443
2423
|
[getter, field](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2444
|
-
FieldType* t = reinterpret_cast<FieldType*>(args[0]
|
|
2445
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
2424
|
+
FieldType* t = reinterpret_cast<FieldType*>(internal::bigIntUint64(rt, args[0]));
|
|
2425
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
2446
2426
|
return getter(field, *t2);
|
|
2447
2427
|
});
|
|
2448
2428
|
|
|
@@ -2451,8 +2431,8 @@ public:
|
|
|
2451
2431
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(fieldName)+"_ster"),
|
|
2452
2432
|
3,
|
|
2453
2433
|
[setter, field](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2454
|
-
FieldType* t = reinterpret_cast<FieldType*>(args[0]
|
|
2455
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
2434
|
+
FieldType* t = reinterpret_cast<FieldType*>(internal::bigIntUint64(rt, args[0]));
|
|
2435
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
2456
2436
|
setter(field, *t2, args[2]);
|
|
2457
2437
|
return facebook::jsi::Value::undefined();
|
|
2458
2438
|
});
|
|
@@ -2487,8 +2467,8 @@ public:
|
|
|
2487
2467
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(fieldName) + "_gter"),
|
|
2488
2468
|
2,
|
|
2489
2469
|
[gter](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2490
|
-
Getter* t = reinterpret_cast<Getter*>(args[0]
|
|
2491
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
2470
|
+
Getter* t = reinterpret_cast<Getter*>(internal::bigIntUint64(rt, args[0]));
|
|
2471
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
2492
2472
|
return gter(*t, *t2);
|
|
2493
2473
|
});
|
|
2494
2474
|
|
|
@@ -2536,8 +2516,8 @@ public:
|
|
|
2536
2516
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(fieldName)+"_gter"),
|
|
2537
2517
|
2,
|
|
2538
2518
|
[gter](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2539
|
-
Getter* t = reinterpret_cast<Getter*>(args[0]
|
|
2540
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
2519
|
+
Getter* t = reinterpret_cast<Getter*>(internal::bigIntUint64(rt, args[0]));
|
|
2520
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
2541
2521
|
return gter(*t, *t2);
|
|
2542
2522
|
});
|
|
2543
2523
|
|
|
@@ -2546,8 +2526,8 @@ public:
|
|
|
2546
2526
|
facebook::jsi::PropNameID::forAscii(*jsRuntime, std::string(fieldName)+"_ster"),
|
|
2547
2527
|
3,
|
|
2548
2528
|
[ster](facebook::jsi::Runtime& rt, const facebook::jsi::Value& thisVal, const facebook::jsi::Value* args, size_t count) {
|
|
2549
|
-
Setter* t = reinterpret_cast<Setter*>(args[0]
|
|
2550
|
-
ClassType* t2 = reinterpret_cast<ClassType*>(args[1]
|
|
2529
|
+
Setter* t = reinterpret_cast<Setter*>(internal::bigIntUint64(rt, args[0]));
|
|
2530
|
+
ClassType* t2 = reinterpret_cast<ClassType*>(internal::bigIntUint64(rt, args[1]));
|
|
2551
2531
|
ster(*t, *t2, args[2]);
|
|
2552
2532
|
return facebook::jsi::Value::undefined();
|
|
2553
2533
|
});
|