@stryke/capnp 0.12.96 → 0.12.98
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/bin/capnpc.cjs +405 -304
- package/bin/capnpc.d.cts +909 -4
- package/bin/capnpc.d.cts.map +1 -1
- package/bin/capnpc.d.mts +909 -4
- package/bin/capnpc.d.mts.map +1 -1
- package/bin/capnpc.mjs +368 -268
- package/bin/capnpc.mjs.map +1 -1
- package/dist/capnp-es.BHkXHvyK-B3-d8RNu.d.mts +2991 -0
- package/dist/capnp-es.BHkXHvyK-B3-d8RNu.d.mts.map +1 -0
- package/dist/capnp-es.BHkXHvyK-CQWXOqvU.d.cts +2991 -0
- package/dist/capnp-es.BHkXHvyK-CQWXOqvU.d.cts.map +1 -0
- package/dist/{capnp-es.GpvEvMIK-C4q8I6qy.mjs → capnp-es.GpvEvMIK-CH8kq1KS.mjs} +13 -6
- package/dist/{capnp-es.GpvEvMIK-C4q8I6qy.mjs.map → capnp-es.GpvEvMIK-CH8kq1KS.mjs.map} +1 -1
- package/dist/{capnp-es.GpvEvMIK-BcYm5JyH.cjs → capnp-es.GpvEvMIK-CZ5ZimCD.cjs} +12 -5
- package/dist/{compile-Cx88xgqJ.mjs → compile-D_BOc0dD.mjs} +109 -15
- package/dist/compile-D_BOc0dD.mjs.map +1 -0
- package/dist/{compile-SmxAaHxW.cjs → compile-Yq1zhccM.cjs} +113 -19
- package/dist/compile.cjs +2 -2
- package/dist/compile.d.cts +38 -3
- package/dist/compile.d.cts.map +1 -0
- package/dist/compile.d.mts +38 -3
- package/dist/compile.d.mts.map +1 -0
- package/dist/compile.mjs +1 -2
- package/dist/{dist-BlvFBzSi.mjs → dist-DQ7xmzRT.mjs} +385 -16
- package/dist/dist-DQ7xmzRT.mjs.map +1 -0
- package/dist/{dist-YywzZL3Q.cjs → dist-VMGxvENY.cjs} +381 -12
- package/dist/{helpers-BoYAadSB.mjs → helpers-2TldkyGG.mjs} +136 -137
- package/dist/helpers-2TldkyGG.mjs.map +1 -0
- package/dist/{helpers-gxlsFdP8.cjs → helpers-Dn4nWOb7.cjs} +164 -165
- package/dist/helpers.cjs +2 -1
- package/dist/helpers.d.cts +1 -2
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.mts +1 -2
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +1 -1
- package/dist/index-63Za7yNc.d.cts +736 -0
- package/dist/index-63Za7yNc.d.cts.map +1 -0
- package/dist/index-LYXu6eWz.d.mts +736 -0
- package/dist/index-LYXu6eWz.d.mts.map +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +5 -4
- package/dist/index.d.mts +5 -4
- package/dist/index.mjs +4 -5
- package/dist/rpc-helpers.cjs +4 -3
- package/dist/rpc-helpers.d.cts +3 -4
- package/dist/rpc-helpers.d.cts.map +1 -1
- package/dist/rpc-helpers.d.mts +3 -4
- package/dist/rpc-helpers.d.mts.map +1 -1
- package/dist/rpc-helpers.mjs +2 -2
- package/dist/types-BjCOVfgj.d.cts +1506 -0
- package/dist/types-BjCOVfgj.d.cts.map +1 -0
- package/dist/types-CVzMn-TI.d.mts +1506 -0
- package/dist/types-CVzMn-TI.d.mts.map +1 -0
- package/dist/types.cjs +8 -2
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.mjs +7 -2
- package/dist/types.mjs.map +1 -0
- package/package.json +5 -5
- package/schemas/cpp.cjs +1 -0
- package/schemas/cpp.d.cts.map +1 -1
- package/schemas/cpp.d.mts.map +1 -1
- package/schemas/index-BB47pUzp.d.cts +742 -0
- package/schemas/index-BB47pUzp.d.cts.map +1 -0
- package/schemas/index-DprjZUdT.d.mts +742 -0
- package/schemas/index-DprjZUdT.d.mts.map +1 -0
- package/schemas/persistent.cjs +2 -1
- package/schemas/persistent.d.cts +48 -21
- package/schemas/persistent.d.cts.map +1 -1
- package/schemas/persistent.d.mts +48 -21
- package/schemas/persistent.d.mts.map +1 -1
- package/schemas/persistent.mjs +1 -1
- package/schemas/persistent.mjs.map +1 -1
- package/schemas/rpc-twoparty.cjs +20 -1
- package/schemas/rpc-twoparty.d.cts +17 -17
- package/schemas/rpc-twoparty.d.cts.map +1 -1
- package/schemas/rpc-twoparty.d.mts +17 -17
- package/schemas/rpc-twoparty.d.mts.map +1 -1
- package/schemas/rpc-twoparty.mjs +19 -1
- package/schemas/rpc-twoparty.mjs.map +1 -1
- package/schemas/rpc.cjs +371 -1
- package/schemas/rpc.d.cts +141 -141
- package/schemas/rpc.d.cts.map +1 -1
- package/schemas/rpc.d.mts +141 -141
- package/schemas/rpc.d.mts.map +1 -1
- package/schemas/rpc.mjs +370 -1
- package/schemas/rpc.mjs.map +1 -1
- package/schemas/schema.cjs +96 -1
- package/schemas/schema.d.cts +286 -228
- package/schemas/schema.d.cts.map +1 -1
- package/schemas/schema.d.mts +286 -228
- package/schemas/schema.d.mts.map +1 -1
- package/schemas/schema.mjs +95 -1
- package/schemas/schema.mjs.map +1 -1
- package/schemas/{src-2eLj6yCr.cjs → src-B6FhDNiV.cjs} +19 -12
- package/schemas/{src-s2pCu2mc.mjs → src-B97sIXSw.mjs} +19 -13
- package/schemas/src-B97sIXSw.mjs.map +1 -0
- package/schemas/ts.cjs +1 -0
- package/schemas/ts.d.cts.map +1 -1
- package/schemas/ts.d.mts.map +1 -1
- package/dist/compile-Cx88xgqJ.mjs.map +0 -1
- package/dist/compile-DccxA7WZ.d.cts +0 -40
- package/dist/compile-DccxA7WZ.d.cts.map +0 -1
- package/dist/compile-UkKIpqrK.d.mts +0 -40
- package/dist/compile-UkKIpqrK.d.mts.map +0 -1
- package/dist/dist-BlvFBzSi.mjs.map +0 -1
- package/dist/helpers-BoYAadSB.mjs.map +0 -1
- package/dist/types-Cuj2daUE.mjs +0 -8
- package/dist/types-Cuj2daUE.mjs.map +0 -1
- package/dist/types-D03SjfBL.d.mts +0 -55
- package/dist/types-D03SjfBL.d.mts.map +0 -1
- package/dist/types-D52qMMoK.d.cts +0 -55
- package/dist/types-D52qMMoK.d.cts.map +0 -1
- package/dist/types-DHrjS-69.cjs +0 -13
- package/schemas/index-BAJMwFip.d.mts +0 -96
- package/schemas/index-BAJMwFip.d.mts.map +0 -1
- package/schemas/index-b7dam4EA.d.cts +0 -96
- package/schemas/index-b7dam4EA.d.cts.map +0 -1
- package/schemas/src-s2pCu2mc.mjs.map +0 -1
|
@@ -21,7 +21,6 @@ const MAX_INT32 = 2147483647;
|
|
|
21
21
|
const MAX_UINT32 = 4294967295;
|
|
22
22
|
const MIN_SINGLE_SEGMENT_GROWTH = 4096;
|
|
23
23
|
const NATIVE_LITTLE_ENDIAN = tmpWord.getUint8(0) === 2;
|
|
24
|
-
const PACK_SPAN_THRESHOLD = 2;
|
|
25
24
|
const POINTER_DOUBLE_FAR_MASK = 4;
|
|
26
25
|
const POINTER_TYPE_MASK = 3;
|
|
27
26
|
const MAX_DEPTH = MAX_INT32;
|
|
@@ -262,6 +261,7 @@ var Orphan = class {
|
|
|
262
261
|
case PointerType.OTHER:
|
|
263
262
|
setInterfacePointer(this._capnp.capId, res.pointer);
|
|
264
263
|
break;
|
|
264
|
+
/* istanbul ignore next */
|
|
265
265
|
default: throw new Error(PTR_INVALID_POINTER_TYPE);
|
|
266
266
|
}
|
|
267
267
|
this._capnp = void 0;
|
|
@@ -302,22 +302,28 @@ function getListByteLength(elementSize, length, compositeSize) {
|
|
|
302
302
|
case ListElementSize.BYTE_8:
|
|
303
303
|
case ListElementSize.POINTER:
|
|
304
304
|
case ListElementSize.VOID: return padToWord$1(getListElementByteLength(elementSize) * length);
|
|
305
|
+
/* istanbul ignore next */
|
|
305
306
|
case ListElementSize.COMPOSITE:
|
|
306
307
|
if (compositeSize === void 0) throw new Error(format(PTR_INVALID_LIST_SIZE, NaN));
|
|
307
308
|
return length * padToWord$1(getByteLength(compositeSize));
|
|
309
|
+
/* istanbul ignore next */
|
|
308
310
|
default: throw new Error(PTR_INVALID_LIST_SIZE);
|
|
309
311
|
}
|
|
310
312
|
}
|
|
311
313
|
function getListElementByteLength(elementSize) {
|
|
312
314
|
switch (elementSize) {
|
|
315
|
+
/* istanbul ignore next */
|
|
313
316
|
case ListElementSize.BIT: return NaN;
|
|
314
317
|
case ListElementSize.BYTE: return 1;
|
|
315
318
|
case ListElementSize.BYTE_2: return 2;
|
|
316
319
|
case ListElementSize.BYTE_4: return 4;
|
|
317
320
|
case ListElementSize.BYTE_8:
|
|
318
321
|
case ListElementSize.POINTER: return 8;
|
|
322
|
+
/* istanbul ignore next */
|
|
319
323
|
case ListElementSize.COMPOSITE: return NaN;
|
|
324
|
+
/* istanbul ignore next */
|
|
320
325
|
case ListElementSize.VOID: return 0;
|
|
326
|
+
/* istanbul ignore next */
|
|
321
327
|
default: throw new Error(format(PTR_INVALID_LIST_SIZE, elementSize));
|
|
322
328
|
}
|
|
323
329
|
}
|
|
@@ -338,6 +344,7 @@ function copyFrom(src, p) {
|
|
|
338
344
|
case PointerType.OTHER:
|
|
339
345
|
copyFromInterface(src, p);
|
|
340
346
|
break;
|
|
347
|
+
/* istanbul ignore next */
|
|
341
348
|
default: throw new Error(format(PTR_INVALID_POINTER_TYPE, getTargetPointerType(p)));
|
|
342
349
|
}
|
|
343
350
|
}
|
|
@@ -1098,7 +1105,7 @@ var ErrorClient = class {
|
|
|
1098
1105
|
}
|
|
1099
1106
|
};
|
|
1100
1107
|
function clientOrNull(client) {
|
|
1101
|
-
return client ?? new ErrorClient(new Error(
|
|
1108
|
+
return client ?? new ErrorClient(new Error("CAPNP-TS100 Call on null client."));
|
|
1102
1109
|
}
|
|
1103
1110
|
const TMP_WORD = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
|
|
1104
1111
|
function initStruct(size, s) {
|
|
@@ -1586,7 +1593,7 @@ var SingleSegmentArena = class {
|
|
|
1586
1593
|
};
|
|
1587
1594
|
function allocate$1(minSize, segments, s) {
|
|
1588
1595
|
const srcBuffer = segments.length > 0 ? segments[0].buffer : s.buffer;
|
|
1589
|
-
minSize = minSize <
|
|
1596
|
+
minSize = minSize < 4096 ? MIN_SINGLE_SEGMENT_GROWTH : padToWord$1(minSize);
|
|
1590
1597
|
s.buffer = new ArrayBuffer(srcBuffer.byteLength + minSize);
|
|
1591
1598
|
new Float64Array(s.buffer).set(new Float64Array(srcBuffer));
|
|
1592
1599
|
return new ArenaAllocationResult(0, s.buffer);
|
|
@@ -1697,7 +1704,7 @@ function pack(unpacked, byteOffset = 0, byteLength) {
|
|
|
1697
1704
|
} else rangeWordCount++;
|
|
1698
1705
|
break;
|
|
1699
1706
|
case 255:
|
|
1700
|
-
if (getZeroByteCount(a, b, c, d, e, f, g, h) >=
|
|
1707
|
+
if (getZeroByteCount(a, b, c, d, e, f, g, h) >= 2 || rangeWordCount >= 255) {
|
|
1701
1708
|
dst[spanWordCountOffset] = rangeWordCount;
|
|
1702
1709
|
rangeWordCount = 0;
|
|
1703
1710
|
skipWriteWord = false;
|
|
@@ -1789,7 +1796,7 @@ var Segment = class {
|
|
|
1789
1796
|
allocate(byteLength) {
|
|
1790
1797
|
let segment = this;
|
|
1791
1798
|
byteLength = padToWord$1(byteLength);
|
|
1792
|
-
if (byteLength >
|
|
1799
|
+
if (byteLength > 4294967295 - 8) throw new Error(format(SEG_SIZE_OVERFLOW, byteLength));
|
|
1793
1800
|
if (!segment.hasCapacity(byteLength)) segment = segment.message.allocateSegment(byteLength);
|
|
1794
1801
|
const byteOffset = segment.byteLength;
|
|
1795
1802
|
segment.byteLength += byteLength;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as writeWarning, t as resolveOptions } from "./helpers-
|
|
2
|
-
import { $t as initData, Cn as setUint64, Ct as getInt8, Dt as getList, Jt as getText, Nt as getPointer, Qt as getUint8, Rt as getStruct, Sn as setUint32, St as getInt64, T as ObjectSize, Tn as testWhich, X as adopt, Xt as getUint32, Yt as getUint16, Zt as getUint64, an as isNull, bn as setText, bt as getInt16, d as getUint16Mask, dn as setFloat32, dt as getAs, en as initList, et as copyFrom, fn as setFloat64, ft as getBit, gn as setInt8, hn as setInt64, ht as getData, it as disown, ln as setBit, mn as setInt32, on as pad, pn as setInt16, q as Struct, r as CompositeList, rn as initStructAt, t as Message, ut as format, vt as getFloat32, wn as setUint8, xn as setUint16, xt as getInt32, yt as getFloat64 } from "./capnp-es.GpvEvMIK-
|
|
1
|
+
import { n as writeWarning, t as resolveOptions } from "./helpers-2TldkyGG.mjs";
|
|
2
|
+
import { $t as initData, Cn as setUint64, Ct as getInt8, Dt as getList, Jt as getText, Nt as getPointer, Qt as getUint8, Rt as getStruct, Sn as setUint32, St as getInt64, T as ObjectSize, Tn as testWhich, X as adopt, Xt as getUint32, Yt as getUint16, Zt as getUint64, an as isNull, bn as setText, bt as getInt16, d as getUint16Mask, dn as setFloat32, dt as getAs, en as initList, et as copyFrom, fn as setFloat64, ft as getBit, gn as setInt8, hn as setInt64, ht as getData, it as disown, ln as setBit, mn as setInt32, on as pad, pn as setInt16, q as Struct, r as CompositeList, rn as initStructAt, t as Message, ut as format, vt as getFloat32, wn as setUint8, xn as setUint16, xt as getInt32, yt as getFloat64 } from "./capnp-es.GpvEvMIK-CH8kq1KS.mjs";
|
|
3
3
|
import { existsSync } from "@stryke/fs/exists";
|
|
4
4
|
import ts from "typescript";
|
|
5
5
|
import defu from "defu";
|
|
@@ -493,10 +493,38 @@ var Node_Annotation = class extends Struct {
|
|
|
493
493
|
};
|
|
494
494
|
const Node_Which = {
|
|
495
495
|
FILE: 0,
|
|
496
|
+
/**
|
|
497
|
+
* Name to present to humans to identify this Node. You should not attempt to parse this. Its
|
|
498
|
+
* format could change. It is not guaranteed to be unique.
|
|
499
|
+
*
|
|
500
|
+
* (On Zooko's triangle, this is the node's nickname.)
|
|
501
|
+
*
|
|
502
|
+
*/
|
|
496
503
|
STRUCT: 1,
|
|
504
|
+
/**
|
|
505
|
+
* If you want a shorter version of `displayName` (just naming this node, without its surrounding
|
|
506
|
+
* scope), chop off this many characters from the beginning of `displayName`.
|
|
507
|
+
*
|
|
508
|
+
*/
|
|
497
509
|
ENUM: 2,
|
|
510
|
+
/**
|
|
511
|
+
* ID of the lexical parent node. Typically, the scope node will have a NestedNode pointing back
|
|
512
|
+
* at this node, but robust code should avoid relying on this (and, in fact, group nodes are not
|
|
513
|
+
* listed in the outer struct's nestedNodes, since they are listed in the fields). `scopeId` is
|
|
514
|
+
* zero if the node has no parent, which is normally only the case with files, but should be
|
|
515
|
+
* allowed for any kind of node (in order to make runtime type generation easier).
|
|
516
|
+
*
|
|
517
|
+
*/
|
|
498
518
|
INTERFACE: 3,
|
|
519
|
+
/**
|
|
520
|
+
* List of nodes nested within this node, along with the names under which they were declared.
|
|
521
|
+
*
|
|
522
|
+
*/
|
|
499
523
|
CONST: 4,
|
|
524
|
+
/**
|
|
525
|
+
* Annotations applied to this node.
|
|
526
|
+
*
|
|
527
|
+
*/
|
|
500
528
|
ANNOTATION: 5
|
|
501
529
|
};
|
|
502
530
|
var Node = class Node extends Struct {
|
|
@@ -814,6 +842,13 @@ var Field_Group = class extends Struct {
|
|
|
814
842
|
};
|
|
815
843
|
const Field_Ordinal_Which = {
|
|
816
844
|
IMPLICIT: 0,
|
|
845
|
+
/**
|
|
846
|
+
* The original ordinal number given to the field. You probably should NOT use this; if you need
|
|
847
|
+
* a numeric identifier for a field, use its position within the field array for its scope.
|
|
848
|
+
* The ordinal is given here mainly just so that the original schema text can be reproduced given
|
|
849
|
+
* the compiled version -- i.e. so that `capnp compile -ocapnp` can do its job.
|
|
850
|
+
*
|
|
851
|
+
*/
|
|
817
852
|
EXPLICIT: 1
|
|
818
853
|
};
|
|
819
854
|
var Field_Ordinal = class extends Struct {
|
|
@@ -857,6 +892,15 @@ var Field_Ordinal = class extends Struct {
|
|
|
857
892
|
};
|
|
858
893
|
const Field_Which = {
|
|
859
894
|
SLOT: 0,
|
|
895
|
+
/**
|
|
896
|
+
* Indicates where this member appeared in the code, relative to other members.
|
|
897
|
+
* Code ordering may have semantic relevance -- programmers tend to place related fields
|
|
898
|
+
* together. So, using code ordering makes sense in human-readable formats where ordering is
|
|
899
|
+
* otherwise irrelevant, like JSON. The values of codeOrder are tightly-packed, so the maximum
|
|
900
|
+
* value is count(members) - 1. Fields that are members of a union are only ordered relative to
|
|
901
|
+
* the other members of that union, so the maximum value there is count(union.members).
|
|
902
|
+
*
|
|
903
|
+
*/
|
|
860
904
|
GROUP: 1
|
|
861
905
|
};
|
|
862
906
|
var Field = class Field extends Struct {
|
|
@@ -1320,9 +1364,25 @@ var Type_Interface = class extends Struct {
|
|
|
1320
1364
|
}
|
|
1321
1365
|
};
|
|
1322
1366
|
const Type_AnyPointer_Unconstrained_Which = {
|
|
1367
|
+
/**
|
|
1368
|
+
* truly AnyPointer
|
|
1369
|
+
*
|
|
1370
|
+
*/
|
|
1323
1371
|
ANY_KIND: 0,
|
|
1372
|
+
/**
|
|
1373
|
+
* AnyStruct
|
|
1374
|
+
*
|
|
1375
|
+
*/
|
|
1324
1376
|
STRUCT: 1,
|
|
1377
|
+
/**
|
|
1378
|
+
* AnyList
|
|
1379
|
+
*
|
|
1380
|
+
*/
|
|
1325
1381
|
LIST: 2,
|
|
1382
|
+
/**
|
|
1383
|
+
* Capability
|
|
1384
|
+
*
|
|
1385
|
+
*/
|
|
1326
1386
|
CAPABILITY: 3
|
|
1327
1387
|
};
|
|
1328
1388
|
var Type_AnyPointer_Unconstrained = class extends Struct {
|
|
@@ -1414,8 +1474,25 @@ var Type_AnyPointer_ImplicitMethodParameter = class extends Struct {
|
|
|
1414
1474
|
}
|
|
1415
1475
|
};
|
|
1416
1476
|
const Type_AnyPointer_Which = {
|
|
1477
|
+
/**
|
|
1478
|
+
* A regular AnyPointer.
|
|
1479
|
+
*
|
|
1480
|
+
* The name "unconstrained" means as opposed to constraining it to match a type parameter.
|
|
1481
|
+
* In retrospect this name is probably a poor choice given that it may still be constrained
|
|
1482
|
+
* to be a struct, list, or capability.
|
|
1483
|
+
*
|
|
1484
|
+
*/
|
|
1417
1485
|
UNCONSTRAINED: 0,
|
|
1486
|
+
/**
|
|
1487
|
+
* This is actually a reference to a type parameter defined within this scope.
|
|
1488
|
+
*
|
|
1489
|
+
*/
|
|
1418
1490
|
PARAMETER: 1,
|
|
1491
|
+
/**
|
|
1492
|
+
* This is actually a reference to an implicit (generic) parameter of a method. The only
|
|
1493
|
+
* legal context for this type to appear is inside Method.paramBrand or Method.resultBrand.
|
|
1494
|
+
*
|
|
1495
|
+
*/
|
|
1419
1496
|
IMPLICIT_METHOD_PARAMETER: 2
|
|
1420
1497
|
};
|
|
1421
1498
|
var Type_AnyPointer = class extends Struct {
|
|
@@ -1701,7 +1778,15 @@ var Type = class extends Struct {
|
|
|
1701
1778
|
}
|
|
1702
1779
|
};
|
|
1703
1780
|
const Brand_Scope_Which = {
|
|
1781
|
+
/**
|
|
1782
|
+
* ID of the scope to which these params apply.
|
|
1783
|
+
*
|
|
1784
|
+
*/
|
|
1704
1785
|
BIND: 0,
|
|
1786
|
+
/**
|
|
1787
|
+
* List of parameter bindings.
|
|
1788
|
+
*
|
|
1789
|
+
*/
|
|
1705
1790
|
INHERIT: 1
|
|
1706
1791
|
};
|
|
1707
1792
|
var Brand_Scope = class Brand_Scope extends Struct {
|
|
@@ -1870,6 +1955,11 @@ const Value_Which = {
|
|
|
1870
1955
|
LIST: 14,
|
|
1871
1956
|
ENUM: 15,
|
|
1872
1957
|
STRUCT: 16,
|
|
1958
|
+
/**
|
|
1959
|
+
* The only interface value that can be represented statically is "null", whose methods always
|
|
1960
|
+
* throw exceptions.
|
|
1961
|
+
*
|
|
1962
|
+
*/
|
|
1873
1963
|
INTERFACE: 17,
|
|
1874
1964
|
ANY_POINTER: 18
|
|
1875
1965
|
};
|
|
@@ -2211,6 +2301,10 @@ var Annotation = class extends Struct {
|
|
|
2211
2301
|
}
|
|
2212
2302
|
};
|
|
2213
2303
|
const ElementSize = {
|
|
2304
|
+
/**
|
|
2305
|
+
* aka "void", but that's a keyword.
|
|
2306
|
+
*
|
|
2307
|
+
*/
|
|
2214
2308
|
EMPTY: 0,
|
|
2215
2309
|
BIT: 1,
|
|
2216
2310
|
BYTE: 2,
|
|
@@ -3046,16 +3140,16 @@ function generateStructFieldMethods(ctx, members, node, field, fieldIndex) {
|
|
|
3046
3140
|
const maybeDefaultArg = hadExplicitDefault ? `, ${fullClassName}._capnp.default${capitalizedName}` : "";
|
|
3047
3141
|
const union = discriminantValue !== Field.NO_DISCRIMINANT;
|
|
3048
3142
|
const offset = field._isSlot ? field.slot.offset : 0;
|
|
3049
|
-
let adopt
|
|
3050
|
-
let disown
|
|
3143
|
+
let adopt = false;
|
|
3144
|
+
let disown = false;
|
|
3051
3145
|
let has = false;
|
|
3052
3146
|
let init;
|
|
3053
3147
|
let get;
|
|
3054
3148
|
let set;
|
|
3055
3149
|
switch (whichType) {
|
|
3056
3150
|
case Type.ANY_POINTER:
|
|
3057
|
-
adopt
|
|
3058
|
-
disown
|
|
3151
|
+
adopt = true;
|
|
3152
|
+
disown = true;
|
|
3059
3153
|
has = true;
|
|
3060
3154
|
get = `$.utils.getPointer(${offset}, this${maybeDefaultArg})`;
|
|
3061
3155
|
set = `$.utils.copyFrom(value, ${get})`;
|
|
@@ -3080,8 +3174,8 @@ function generateStructFieldMethods(ctx, members, node, field, fieldIndex) {
|
|
|
3080
3174
|
break;
|
|
3081
3175
|
}
|
|
3082
3176
|
case Type.DATA:
|
|
3083
|
-
adopt
|
|
3084
|
-
disown
|
|
3177
|
+
adopt = true;
|
|
3178
|
+
disown = true;
|
|
3085
3179
|
has = true;
|
|
3086
3180
|
get = `$.utils.getData(${offset}, this${maybeDefaultArg})`;
|
|
3087
3181
|
set = `$.utils.copyFrom(value, $.utils.getPointer(${offset}, this))`;
|
|
@@ -3096,8 +3190,8 @@ function generateStructFieldMethods(ctx, members, node, field, fieldIndex) {
|
|
|
3096
3190
|
let listClass = ConcreteListType[elementType];
|
|
3097
3191
|
if (elementType === Type.LIST || elementType === Type.STRUCT) listClass = `${fullClassName}._${capitalizedName}`;
|
|
3098
3192
|
else if (listClass === void 0) throw new Error(format(GEN_UNSUPPORTED_LIST_ELEMENT_TYPE, elementType));
|
|
3099
|
-
adopt
|
|
3100
|
-
disown
|
|
3193
|
+
adopt = true;
|
|
3194
|
+
disown = true;
|
|
3101
3195
|
has = true;
|
|
3102
3196
|
get = `$.utils.getList(${offset}, ${listClass}, this${maybeDefaultArg})`;
|
|
3103
3197
|
set = `$.utils.copyFrom(value, $.utils.getPointer(${offset}, this))`;
|
|
@@ -3109,8 +3203,8 @@ function generateStructFieldMethods(ctx, members, node, field, fieldIndex) {
|
|
|
3109
3203
|
break;
|
|
3110
3204
|
}
|
|
3111
3205
|
case Type.STRUCT:
|
|
3112
|
-
adopt
|
|
3113
|
-
disown
|
|
3206
|
+
adopt = true;
|
|
3207
|
+
disown = true;
|
|
3114
3208
|
has = true;
|
|
3115
3209
|
get = `$.utils.getStruct(${offset}, ${jsType}, this${maybeDefaultArg})`;
|
|
3116
3210
|
set = `$.utils.copyFrom(value, $.utils.getPointer(${offset}, this))`;
|
|
@@ -3127,13 +3221,13 @@ function generateStructFieldMethods(ctx, members, node, field, fieldIndex) {
|
|
|
3127
3221
|
init = get;
|
|
3128
3222
|
break;
|
|
3129
3223
|
}
|
|
3130
|
-
if (adopt
|
|
3224
|
+
if (adopt) members.push(`
|
|
3131
3225
|
_adopt${capitalizedName}(value: $.Orphan<${jsType}>): void {
|
|
3132
3226
|
${union ? `$.utils.setUint16(${discriminantOffset * 2}, ${discriminantValue}, this);` : ""}
|
|
3133
3227
|
$.utils.adopt(value, $.utils.getPointer(${offset}, this));
|
|
3134
3228
|
}
|
|
3135
3229
|
`);
|
|
3136
|
-
if (disown
|
|
3230
|
+
if (disown) members.push(`
|
|
3137
3231
|
_disown${capitalizedName}(): $.Orphan<${jsType}> {
|
|
3138
3232
|
return $.utils.disown(this.${name === "constructor" ? `$${name}` : name});
|
|
3139
3233
|
}
|
|
@@ -3521,4 +3615,4 @@ async function compile(dataBuf, options) {
|
|
|
3521
3615
|
|
|
3522
3616
|
//#endregion
|
|
3523
3617
|
export { compile as n, capnpc as t };
|
|
3524
|
-
//# sourceMappingURL=compile-
|
|
3618
|
+
//# sourceMappingURL=compile-D_BOc0dD.mjs.map
|