UNPKG

@stryke/capnp

Version:

A package to assist in running the Cap'n Proto compiler and creating Cap'n Proto serialization protocol schemas.

1,951 lines (1,950 loc) 69.6 kB
import { CompositeList, ObjectSize, Struct, getUint16Mask, utils } from "./chunk-SCCB7KM2.js"; import { __name } from "./chunk-SHUYVCID.js"; // schemas/schema.ts var _capnpFileId = BigInt("0xa93fc509624c72d9"); var Node_Parameter = class extends Struct { static { __name(this, "Node_Parameter"); } static _capnp = { displayName: "Parameter", id: "b9521bccf10fa3b1", size: new ObjectSize(0, 1) }; get name() { return utils.getText(0, this); } set name(value) { utils.setText(0, value, this); } toString() { return "Node_Parameter_" + super.toString(); } }; var Node_NestedNode = class extends Struct { static { __name(this, "Node_NestedNode"); } static _capnp = { displayName: "NestedNode", id: "debf55bbfa0fc242", size: new ObjectSize(8, 1) }; /** * Unqualified symbol name. Unlike Node.displayName, this *can* be used programmatically. * * (On Zooko's triangle, this is the node's petname according to its parent scope.) * */ get name() { return utils.getText(0, this); } set name(value) { utils.setText(0, value, this); } /** * ID of the nested node. Typically, the target node's scopeId points back to this node, but * robust code should avoid relying on this. * */ get id() { return utils.getUint64(0, this); } set id(value) { utils.setUint64(0, value, this); } toString() { return "Node_NestedNode_" + super.toString(); } }; var Node_SourceInfo_Member = class extends Struct { static { __name(this, "Node_SourceInfo_Member"); } static _capnp = { displayName: "Member", id: "c2ba9038898e1fa2", size: new ObjectSize(0, 1) }; /** * Doc comment on the member. * */ get docComment() { return utils.getText(0, this); } set docComment(value) { utils.setText(0, value, this); } toString() { return "Node_SourceInfo_Member_" + super.toString(); } }; var Node_SourceInfo = class _Node_SourceInfo extends Struct { static { __name(this, "Node_SourceInfo"); } static Member = Node_SourceInfo_Member; static _capnp = { displayName: "SourceInfo", id: "f38e1de3041357ae", size: new ObjectSize(8, 2) }; static _Members; /** * ID of the Node which this info describes. * */ get id() { return utils.getUint64(0, this); } set id(value) { utils.setUint64(0, value, this); } /** * The top-level doc comment for the Node. * */ get docComment() { return utils.getText(0, this); } set docComment(value) { utils.setText(0, value, this); } _adoptMembers(value) { utils.adopt(value, utils.getPointer(1, this)); } _disownMembers() { return utils.disown(this.members); } /** * Information about each member -- i.e. fields (for structs), enumerants (for enums), or * methods (for interfaces). * * This list is the same length and order as the corresponding list in the Node, i.e. * Node.struct.fields, Node.enum.enumerants, or Node.interface.methods. * */ get members() { return utils.getList(1, _Node_SourceInfo._Members, this); } _hasMembers() { return !utils.isNull(utils.getPointer(1, this)); } _initMembers(length) { return utils.initList(1, _Node_SourceInfo._Members, length, this); } set members(value) { utils.copyFrom(value, utils.getPointer(1, this)); } toString() { return "Node_SourceInfo_" + super.toString(); } }; var Node_Struct = class _Node_Struct extends Struct { static { __name(this, "Node_Struct"); } static _capnp = { displayName: "struct", id: "9ea0b19b37fb4435", size: new ObjectSize(40, 6) }; static _Fields; /** * Size of the data section, in words. * */ get dataWordCount() { return utils.getUint16(14, this); } set dataWordCount(value) { utils.setUint16(14, value, this); } /** * Size of the pointer section, in pointers (which are one word each). * */ get pointerCount() { return utils.getUint16(24, this); } set pointerCount(value) { utils.setUint16(24, value, this); } /** * The preferred element size to use when encoding a list of this struct. If this is anything * other than `inlineComposite` then the struct is one word or less in size and is a candidate * for list packing optimization. * */ get preferredListEncoding() { return utils.getUint16(26, this); } set preferredListEncoding(value) { utils.setUint16(26, value, this); } /** * If true, then this "struct" node is actually not an independent node, but merely represents * some named union or group within a particular parent struct. This node's scopeId refers * to the parent struct, which may itself be a union/group in yet another struct. * * All group nodes share the same dataWordCount and pointerCount as the top-level * struct, and their fields live in the same ordinal and offset spaces as all other fields in * the struct. * * Note that a named union is considered a special kind of group -- in fact, a named union * is exactly equivalent to a group that contains nothing but an unnamed union. * */ get isGroup() { return utils.getBit(224, this); } set isGroup(value) { utils.setBit(224, value, this); } /** * Number of fields in this struct which are members of an anonymous union, and thus may * overlap. If this is non-zero, then a 16-bit discriminant is present indicating which * of the overlapping fields is active. This can never be 1 -- if it is non-zero, it must be * two or more. * * Note that the fields of an unnamed union are considered fields of the scope containing the * union -- an unnamed union is not its own group. So, a top-level struct may contain a * non-zero discriminant count. Named unions, on the other hand, are equivalent to groups * containing unnamed unions. So, a named union has its own independent schema node, with * `isGroup` = true. * */ get discriminantCount() { return utils.getUint16(30, this); } set discriminantCount(value) { utils.setUint16(30, value, this); } /** * If `discriminantCount` is non-zero, this is the offset of the union discriminant, in * multiples of 16 bits. * */ get discriminantOffset() { return utils.getUint32(32, this); } set discriminantOffset(value) { utils.setUint32(32, value, this); } _adoptFields(value) { utils.adopt(value, utils.getPointer(3, this)); } _disownFields() { return utils.disown(this.fields); } /** * Fields defined within this scope (either the struct's top-level fields, or the fields of * a particular group; see `isGroup`). * * The fields are sorted by ordinal number, but note that because groups share the same * ordinal space, the field's index in this list is not necessarily exactly its ordinal. * On the other hand, the field's position in this list does remain the same even as the * protocol evolves, since it is not possible to insert or remove an earlier ordinal. * Therefore, for most use cases, if you want to identify a field by number, it may make the * most sense to use the field's index in this list rather than its ordinal. * */ get fields() { return utils.getList(3, _Node_Struct._Fields, this); } _hasFields() { return !utils.isNull(utils.getPointer(3, this)); } _initFields(length) { return utils.initList(3, _Node_Struct._Fields, length, this); } set fields(value) { utils.copyFrom(value, utils.getPointer(3, this)); } toString() { return "Node_Struct_" + super.toString(); } }; var Node_Enum = class _Node_Enum extends Struct { static { __name(this, "Node_Enum"); } static _capnp = { displayName: "enum", id: "b54ab3364333f598", size: new ObjectSize(40, 6) }; static _Enumerants; _adoptEnumerants(value) { utils.adopt(value, utils.getPointer(3, this)); } _disownEnumerants() { return utils.disown(this.enumerants); } /** * Enumerants ordered by numeric value (ordinal). * */ get enumerants() { return utils.getList(3, _Node_Enum._Enumerants, this); } _hasEnumerants() { return !utils.isNull(utils.getPointer(3, this)); } _initEnumerants(length) { return utils.initList(3, _Node_Enum._Enumerants, length, this); } set enumerants(value) { utils.copyFrom(value, utils.getPointer(3, this)); } toString() { return "Node_Enum_" + super.toString(); } }; var Node_Interface = class _Node_Interface extends Struct { static { __name(this, "Node_Interface"); } static _capnp = { displayName: "interface", id: "e82753cff0c2218f", size: new ObjectSize(40, 6) }; static _Methods; static _Superclasses; _adoptMethods(value) { utils.adopt(value, utils.getPointer(3, this)); } _disownMethods() { return utils.disown(this.methods); } /** * Methods ordered by ordinal. * */ get methods() { return utils.getList(3, _Node_Interface._Methods, this); } _hasMethods() { return !utils.isNull(utils.getPointer(3, this)); } _initMethods(length) { return utils.initList(3, _Node_Interface._Methods, length, this); } set methods(value) { utils.copyFrom(value, utils.getPointer(3, this)); } _adoptSuperclasses(value) { utils.adopt(value, utils.getPointer(4, this)); } _disownSuperclasses() { return utils.disown(this.superclasses); } /** * Superclasses of this interface. * */ get superclasses() { return utils.getList(4, _Node_Interface._Superclasses, this); } _hasSuperclasses() { return !utils.isNull(utils.getPointer(4, this)); } _initSuperclasses(length) { return utils.initList(4, _Node_Interface._Superclasses, length, this); } set superclasses(value) { utils.copyFrom(value, utils.getPointer(4, this)); } toString() { return "Node_Interface_" + super.toString(); } }; var Node_Const = class extends Struct { static { __name(this, "Node_Const"); } static _capnp = { displayName: "const", id: "b18aa5ac7a0d9420", size: new ObjectSize(40, 6) }; _adoptType(value) { utils.adopt(value, utils.getPointer(3, this)); } _disownType() { return utils.disown(this.type); } get type() { return utils.getStruct(3, Type, this); } _hasType() { return !utils.isNull(utils.getPointer(3, this)); } _initType() { return utils.initStructAt(3, Type, this); } set type(value) { utils.copyFrom(value, utils.getPointer(3, this)); } _adoptValue(value) { utils.adopt(value, utils.getPointer(4, this)); } _disownValue() { return utils.disown(this.value); } get value() { return utils.getStruct(4, Value, this); } _hasValue() { return !utils.isNull(utils.getPointer(4, this)); } _initValue() { return utils.initStructAt(4, Value, this); } set value(value) { utils.copyFrom(value, utils.getPointer(4, this)); } toString() { return "Node_Const_" + super.toString(); } }; var Node_Annotation = class extends Struct { static { __name(this, "Node_Annotation"); } static _capnp = { displayName: "annotation", id: "ec1619d4400a0290", size: new ObjectSize(40, 6) }; _adoptType(value) { utils.adopt(value, utils.getPointer(3, this)); } _disownType() { return utils.disown(this.type); } get type() { return utils.getStruct(3, Type, this); } _hasType() { return !utils.isNull(utils.getPointer(3, this)); } _initType() { return utils.initStructAt(3, Type, this); } set type(value) { utils.copyFrom(value, utils.getPointer(3, this)); } get targetsFile() { return utils.getBit(112, this); } set targetsFile(value) { utils.setBit(112, value, this); } get targetsConst() { return utils.getBit(113, this); } set targetsConst(value) { utils.setBit(113, value, this); } get targetsEnum() { return utils.getBit(114, this); } set targetsEnum(value) { utils.setBit(114, value, this); } get targetsEnumerant() { return utils.getBit(115, this); } set targetsEnumerant(value) { utils.setBit(115, value, this); } get targetsStruct() { return utils.getBit(116, this); } set targetsStruct(value) { utils.setBit(116, value, this); } get targetsField() { return utils.getBit(117, this); } set targetsField(value) { utils.setBit(117, value, this); } get targetsUnion() { return utils.getBit(118, this); } set targetsUnion(value) { utils.setBit(118, value, this); } get targetsGroup() { return utils.getBit(119, this); } set targetsGroup(value) { utils.setBit(119, value, this); } get targetsInterface() { return utils.getBit(120, this); } set targetsInterface(value) { utils.setBit(120, value, this); } get targetsMethod() { return utils.getBit(121, this); } set targetsMethod(value) { utils.setBit(121, value, this); } get targetsParam() { return utils.getBit(122, this); } set targetsParam(value) { utils.setBit(122, value, this); } get targetsAnnotation() { return utils.getBit(123, this); } set targetsAnnotation(value) { utils.setBit(123, value, this); } toString() { return "Node_Annotation_" + super.toString(); } }; var Node_Which = { FILE: 0, /** * Name to present to humans to identify this Node. You should not attempt to parse this. Its * format could change. It is not guaranteed to be unique. * * (On Zooko's triangle, this is the node's nickname.) * */ STRUCT: 1, /** * If you want a shorter version of `displayName` (just naming this node, without its surrounding * scope), chop off this many characters from the beginning of `displayName`. * */ ENUM: 2, /** * ID of the lexical parent node. Typically, the scope node will have a NestedNode pointing back * at this node, but robust code should avoid relying on this (and, in fact, group nodes are not * listed in the outer struct's nestedNodes, since they are listed in the fields). `scopeId` is * zero if the node has no parent, which is normally only the case with files, but should be * allowed for any kind of node (in order to make runtime type generation easier). * */ INTERFACE: 3, /** * List of nodes nested within this node, along with the names under which they were declared. * */ CONST: 4, /** * Annotations applied to this node. * */ ANNOTATION: 5 }; var Node = class _Node extends Struct { static { __name(this, "Node"); } static FILE = Node_Which.FILE; static STRUCT = Node_Which.STRUCT; static ENUM = Node_Which.ENUM; static INTERFACE = Node_Which.INTERFACE; static CONST = Node_Which.CONST; static ANNOTATION = Node_Which.ANNOTATION; static Parameter = Node_Parameter; static NestedNode = Node_NestedNode; static SourceInfo = Node_SourceInfo; static _capnp = { displayName: "Node", id: "e682ab4cf923a417", size: new ObjectSize(40, 6) }; static _Parameters; static _NestedNodes; static _Annotations; get id() { return utils.getUint64(0, this); } set id(value) { utils.setUint64(0, value, this); } /** * Name to present to humans to identify this Node. You should not attempt to parse this. Its * format could change. It is not guaranteed to be unique. * * (On Zooko's triangle, this is the node's nickname.) * */ get displayName() { return utils.getText(0, this); } set displayName(value) { utils.setText(0, value, this); } /** * If you want a shorter version of `displayName` (just naming this node, without its surrounding * scope), chop off this many characters from the beginning of `displayName`. * */ get displayNamePrefixLength() { return utils.getUint32(8, this); } set displayNamePrefixLength(value) { utils.setUint32(8, value, this); } /** * ID of the lexical parent node. Typically, the scope node will have a NestedNode pointing back * at this node, but robust code should avoid relying on this (and, in fact, group nodes are not * listed in the outer struct's nestedNodes, since they are listed in the fields). `scopeId` is * zero if the node has no parent, which is normally only the case with files, but should be * allowed for any kind of node (in order to make runtime type generation easier). * */ get scopeId() { return utils.getUint64(16, this); } set scopeId(value) { utils.setUint64(16, value, this); } _adoptParameters(value) { utils.adopt(value, utils.getPointer(5, this)); } _disownParameters() { return utils.disown(this.parameters); } /** * If this node is parameterized (generic), the list of parameters. Empty for non-generic types. * */ get parameters() { return utils.getList(5, _Node._Parameters, this); } _hasParameters() { return !utils.isNull(utils.getPointer(5, this)); } _initParameters(length) { return utils.initList(5, _Node._Parameters, length, this); } set parameters(value) { utils.copyFrom(value, utils.getPointer(5, this)); } /** * True if this node is generic, meaning that it or one of its parent scopes has a non-empty * `parameters`. * */ get isGeneric() { return utils.getBit(288, this); } set isGeneric(value) { utils.setBit(288, value, this); } _adoptNestedNodes(value) { utils.adopt(value, utils.getPointer(1, this)); } _disownNestedNodes() { return utils.disown(this.nestedNodes); } /** * List of nodes nested within this node, along with the names under which they were declared. * */ get nestedNodes() { return utils.getList(1, _Node._NestedNodes, this); } _hasNestedNodes() { return !utils.isNull(utils.getPointer(1, this)); } _initNestedNodes(length) { return utils.initList(1, _Node._NestedNodes, length, this); } set nestedNodes(value) { utils.copyFrom(value, utils.getPointer(1, this)); } _adoptAnnotations(value) { utils.adopt(value, utils.getPointer(2, this)); } _disownAnnotations() { return utils.disown(this.annotations); } /** * Annotations applied to this node. * */ get annotations() { return utils.getList(2, _Node._Annotations, this); } _hasAnnotations() { return !utils.isNull(utils.getPointer(2, this)); } _initAnnotations(length) { return utils.initList(2, _Node._Annotations, length, this); } set annotations(value) { utils.copyFrom(value, utils.getPointer(2, this)); } get _isFile() { return utils.getUint16(12, this) === 0; } set file(_) { utils.setUint16(12, 0, this); } get struct() { utils.testWhich("struct", utils.getUint16(12, this), 1, this); return utils.getAs(Node_Struct, this); } _initStruct() { utils.setUint16(12, 1, this); return utils.getAs(Node_Struct, this); } get _isStruct() { return utils.getUint16(12, this) === 1; } set struct(_) { utils.setUint16(12, 1, this); } get enum() { utils.testWhich("enum", utils.getUint16(12, this), 2, this); return utils.getAs(Node_Enum, this); } _initEnum() { utils.setUint16(12, 2, this); return utils.getAs(Node_Enum, this); } get _isEnum() { return utils.getUint16(12, this) === 2; } set enum(_) { utils.setUint16(12, 2, this); } get interface() { utils.testWhich("interface", utils.getUint16(12, this), 3, this); return utils.getAs(Node_Interface, this); } _initInterface() { utils.setUint16(12, 3, this); return utils.getAs(Node_Interface, this); } get _isInterface() { return utils.getUint16(12, this) === 3; } set interface(_) { utils.setUint16(12, 3, this); } get const() { utils.testWhich("const", utils.getUint16(12, this), 4, this); return utils.getAs(Node_Const, this); } _initConst() { utils.setUint16(12, 4, this); return utils.getAs(Node_Const, this); } get _isConst() { return utils.getUint16(12, this) === 4; } set const(_) { utils.setUint16(12, 4, this); } get annotation() { utils.testWhich("annotation", utils.getUint16(12, this), 5, this); return utils.getAs(Node_Annotation, this); } _initAnnotation() { utils.setUint16(12, 5, this); return utils.getAs(Node_Annotation, this); } get _isAnnotation() { return utils.getUint16(12, this) === 5; } set annotation(_) { utils.setUint16(12, 5, this); } toString() { return "Node_" + super.toString(); } which() { return utils.getUint16(12, this); } }; var Field_Slot = class extends Struct { static { __name(this, "Field_Slot"); } static _capnp = { displayName: "slot", id: "c42305476bb4746f", size: new ObjectSize(24, 4) }; /** * Offset, in units of the field's size, from the beginning of the section in which the field * resides. E.g. for a UInt32 field, multiply this by 4 to get the byte offset from the * beginning of the data section. * */ get offset() { return utils.getUint32(4, this); } set offset(value) { utils.setUint32(4, value, this); } _adoptType(value) { utils.adopt(value, utils.getPointer(2, this)); } _disownType() { return utils.disown(this.type); } get type() { return utils.getStruct(2, Type, this); } _hasType() { return !utils.isNull(utils.getPointer(2, this)); } _initType() { return utils.initStructAt(2, Type, this); } set type(value) { utils.copyFrom(value, utils.getPointer(2, this)); } _adoptDefaultValue(value) { utils.adopt(value, utils.getPointer(3, this)); } _disownDefaultValue() { return utils.disown(this.defaultValue); } get defaultValue() { return utils.getStruct(3, Value, this); } _hasDefaultValue() { return !utils.isNull(utils.getPointer(3, this)); } _initDefaultValue() { return utils.initStructAt(3, Value, this); } set defaultValue(value) { utils.copyFrom(value, utils.getPointer(3, this)); } /** * Whether the default value was specified explicitly. Non-explicit default values are always * zero or empty values. Usually, whether the default value was explicit shouldn't matter. * The main use case for this flag is for structs representing method parameters: * explicitly-defaulted parameters may be allowed to be omitted when calling the method. * */ get hadExplicitDefault() { return utils.getBit(128, this); } set hadExplicitDefault(value) { utils.setBit(128, value, this); } toString() { return "Field_Slot_" + super.toString(); } }; var Field_Group = class extends Struct { static { __name(this, "Field_Group"); } static _capnp = { displayName: "group", id: "cafccddb68db1d11", size: new ObjectSize(24, 4) }; /** * The ID of the group's node. * */ get typeId() { return utils.getUint64(16, this); } set typeId(value) { utils.setUint64(16, value, this); } toString() { return "Field_Group_" + super.toString(); } }; var Field_Ordinal_Which = { IMPLICIT: 0, /** * The original ordinal number given to the field. You probably should NOT use this; if you need * a numeric identifier for a field, use its position within the field array for its scope. * The ordinal is given here mainly just so that the original schema text can be reproduced given * the compiled version -- i.e. so that `capnp compile -ocapnp` can do its job. * */ EXPLICIT: 1 }; var Field_Ordinal = class extends Struct { static { __name(this, "Field_Ordinal"); } static IMPLICIT = Field_Ordinal_Which.IMPLICIT; static EXPLICIT = Field_Ordinal_Which.EXPLICIT; static _capnp = { displayName: "ordinal", id: "bb90d5c287870be6", size: new ObjectSize(24, 4) }; get _isImplicit() { return utils.getUint16(10, this) === 0; } set implicit(_) { utils.setUint16(10, 0, this); } /** * The original ordinal number given to the field. You probably should NOT use this; if you need * a numeric identifier for a field, use its position within the field array for its scope. * The ordinal is given here mainly just so that the original schema text can be reproduced given * the compiled version -- i.e. so that `capnp compile -ocapnp` can do its job. * */ get explicit() { utils.testWhich("explicit", utils.getUint16(10, this), 1, this); return utils.getUint16(12, this); } get _isExplicit() { return utils.getUint16(10, this) === 1; } set explicit(value) { utils.setUint16(10, 1, this); utils.setUint16(12, value, this); } toString() { return "Field_Ordinal_" + super.toString(); } which() { return utils.getUint16(10, this); } }; var Field_Which = { SLOT: 0, /** * Indicates where this member appeared in the code, relative to other members. * Code ordering may have semantic relevance -- programmers tend to place related fields * together. So, using code ordering makes sense in human-readable formats where ordering is * otherwise irrelevant, like JSON. The values of codeOrder are tightly-packed, so the maximum * value is count(members) - 1. Fields that are members of a union are only ordered relative to * the other members of that union, so the maximum value there is count(union.members). * */ GROUP: 1 }; var Field = class _Field extends Struct { static { __name(this, "Field"); } static NO_DISCRIMINANT = 65535; static SLOT = Field_Which.SLOT; static GROUP = Field_Which.GROUP; static _capnp = { displayName: "Field", id: "9aad50a41f4af45f", size: new ObjectSize(24, 4), defaultDiscriminantValue: getUint16Mask(65535) }; static _Annotations; get name() { return utils.getText(0, this); } set name(value) { utils.setText(0, value, this); } /** * Indicates where this member appeared in the code, relative to other members. * Code ordering may have semantic relevance -- programmers tend to place related fields * together. So, using code ordering makes sense in human-readable formats where ordering is * otherwise irrelevant, like JSON. The values of codeOrder are tightly-packed, so the maximum * value is count(members) - 1. Fields that are members of a union are only ordered relative to * the other members of that union, so the maximum value there is count(union.members). * */ get codeOrder() { return utils.getUint16(0, this); } set codeOrder(value) { utils.setUint16(0, value, this); } _adoptAnnotations(value) { utils.adopt(value, utils.getPointer(1, this)); } _disownAnnotations() { return utils.disown(this.annotations); } get annotations() { return utils.getList(1, _Field._Annotations, this); } _hasAnnotations() { return !utils.isNull(utils.getPointer(1, this)); } _initAnnotations(length) { return utils.initList(1, _Field._Annotations, length, this); } set annotations(value) { utils.copyFrom(value, utils.getPointer(1, this)); } /** * If the field is in a union, this is the value which the union's discriminant should take when * the field is active. If the field is not in a union, this is 0xffff. * */ get discriminantValue() { return utils.getUint16(2, this, _Field._capnp.defaultDiscriminantValue); } set discriminantValue(value) { utils.setUint16(2, value, this, _Field._capnp.defaultDiscriminantValue); } /** * A regular, non-group, non-fixed-list field. * */ get slot() { utils.testWhich("slot", utils.getUint16(8, this), 0, this); return utils.getAs(Field_Slot, this); } _initSlot() { utils.setUint16(8, 0, this); return utils.getAs(Field_Slot, this); } get _isSlot() { return utils.getUint16(8, this) === 0; } set slot(_) { utils.setUint16(8, 0, this); } /** * A group. * */ get group() { utils.testWhich("group", utils.getUint16(8, this), 1, this); return utils.getAs(Field_Group, this); } _initGroup() { utils.setUint16(8, 1, this); return utils.getAs(Field_Group, this); } get _isGroup() { return utils.getUint16(8, this) === 1; } set group(_) { utils.setUint16(8, 1, this); } get ordinal() { return utils.getAs(Field_Ordinal, this); } _initOrdinal() { return utils.getAs(Field_Ordinal, this); } toString() { return "Field_" + super.toString(); } which() { return utils.getUint16(8, this); } }; var Enumerant = class _Enumerant extends Struct { static { __name(this, "Enumerant"); } static _capnp = { displayName: "Enumerant", id: "978a7cebdc549a4d", size: new ObjectSize(8, 2) }; static _Annotations; get name() { return utils.getText(0, this); } set name(value) { utils.setText(0, value, this); } /** * Specifies order in which the enumerants were declared in the code. * Like utils.Field.codeOrder. * */ get codeOrder() { return utils.getUint16(0, this); } set codeOrder(value) { utils.setUint16(0, value, this); } _adoptAnnotations(value) { utils.adopt(value, utils.getPointer(1, this)); } _disownAnnotations() { return utils.disown(this.annotations); } get annotations() { return utils.getList(1, _Enumerant._Annotations, this); } _hasAnnotations() { return !utils.isNull(utils.getPointer(1, this)); } _initAnnotations(length) { return utils.initList(1, _Enumerant._Annotations, length, this); } set annotations(value) { utils.copyFrom(value, utils.getPointer(1, this)); } toString() { return "Enumerant_" + super.toString(); } }; var Superclass = class extends Struct { static { __name(this, "Superclass"); } static _capnp = { displayName: "Superclass", id: "a9962a9ed0a4d7f8", size: new ObjectSize(8, 1) }; get id() { return utils.getUint64(0, this); } set id(value) { utils.setUint64(0, value, this); } _adoptBrand(value) { utils.adopt(value, utils.getPointer(0, this)); } _disownBrand() { return utils.disown(this.brand); } get brand() { return utils.getStruct(0, Brand, this); } _hasBrand() { return !utils.isNull(utils.getPointer(0, this)); } _initBrand() { return utils.initStructAt(0, Brand, this); } set brand(value) { utils.copyFrom(value, utils.getPointer(0, this)); } toString() { return "Superclass_" + super.toString(); } }; var Method = class _Method extends Struct { static { __name(this, "Method"); } static _capnp = { displayName: "Method", id: "9500cce23b334d80", size: new ObjectSize(24, 5) }; static _ImplicitParameters; static _Annotations; get name() { return utils.getText(0, this); } set name(value) { utils.setText(0, value, this); } /** * Specifies order in which the methods were declared in the code. * Like utils.Field.codeOrder. * */ get codeOrder() { return utils.getUint16(0, this); } set codeOrder(value) { utils.setUint16(0, value, this); } _adoptImplicitParameters(value) { utils.adopt(value, utils.getPointer(4, this)); } _disownImplicitParameters() { return utils.disown(this.implicitParameters); } /** * The parameters listed in [] (typically, type / generic parameters), whose bindings are intended * to be inferred rather than specified explicitly, although not all languages support this. * */ get implicitParameters() { return utils.getList(4, _Method._ImplicitParameters, this); } _hasImplicitParameters() { return !utils.isNull(utils.getPointer(4, this)); } _initImplicitParameters(length) { return utils.initList(4, _Method._ImplicitParameters, length, this); } set implicitParameters(value) { utils.copyFrom(value, utils.getPointer(4, this)); } /** * ID of the parameter struct type. If a named parameter list was specified in the method * declaration (rather than a single struct parameter type) then a corresponding struct type is * auto-generated. Such an auto-generated type will not be listed in the interface's * `nestedNodes` and its `scopeId` will be zero -- it is completely detached from the namespace. * (Awkwardly, it does of course inherit generic parameters from the method's scope, which makes * this a situation where you can't just climb the scope chain to find where a particular * generic parameter was introduced. Making the `scopeId` zero was a mistake.) * */ get paramStructType() { return utils.getUint64(8, this); } set paramStructType(value) { utils.setUint64(8, value, this); } _adoptParamBrand(value) { utils.adopt(value, utils.getPointer(2, this)); } _disownParamBrand() { return utils.disown(this.paramBrand); } /** * Brand of param struct type. * */ get paramBrand() { return utils.getStruct(2, Brand, this); } _hasParamBrand() { return !utils.isNull(utils.getPointer(2, this)); } _initParamBrand() { return utils.initStructAt(2, Brand, this); } set paramBrand(value) { utils.copyFrom(value, utils.getPointer(2, this)); } /** * ID of the return struct type; similar to `paramStructType`. * */ get resultStructType() { return utils.getUint64(16, this); } set resultStructType(value) { utils.setUint64(16, value, this); } _adoptResultBrand(value) { utils.adopt(value, utils.getPointer(3, this)); } _disownResultBrand() { return utils.disown(this.resultBrand); } /** * Brand of result struct type. * */ get resultBrand() { return utils.getStruct(3, Brand, this); } _hasResultBrand() { return !utils.isNull(utils.getPointer(3, this)); } _initResultBrand() { return utils.initStructAt(3, Brand, this); } set resultBrand(value) { utils.copyFrom(value, utils.getPointer(3, this)); } _adoptAnnotations(value) { utils.adopt(value, utils.getPointer(1, this)); } _disownAnnotations() { return utils.disown(this.annotations); } get annotations() { return utils.getList(1, _Method._Annotations, this); } _hasAnnotations() { return !utils.isNull(utils.getPointer(1, this)); } _initAnnotations(length) { return utils.initList(1, _Method._Annotations, length, this); } set annotations(value) { utils.copyFrom(value, utils.getPointer(1, this)); } toString() { return "Method_" + super.toString(); } }; var Type_List = class extends Struct { static { __name(this, "Type_List"); } static _capnp = { displayName: "list", id: "87e739250a60ea97", size: new ObjectSize(24, 1) }; _adoptElementType(value) { utils.adopt(value, utils.getPointer(0, this)); } _disownElementType() { return utils.disown(this.elementType); } get elementType() { return utils.getStruct(0, Type, this); } _hasElementType() { return !utils.isNull(utils.getPointer(0, this)); } _initElementType() { return utils.initStructAt(0, Type, this); } set elementType(value) { utils.copyFrom(value, utils.getPointer(0, this)); } toString() { return "Type_List_" + super.toString(); } }; var Type_Enum = class extends Struct { static { __name(this, "Type_Enum"); } static _capnp = { displayName: "enum", id: "9e0e78711a7f87a9", size: new ObjectSize(24, 1) }; get typeId() { return utils.getUint64(8, this); } set typeId(value) { utils.setUint64(8, value, this); } _adoptBrand(value) { utils.adopt(value, utils.getPointer(0, this)); } _disownBrand() { return utils.disown(this.brand); } get brand() { return utils.getStruct(0, Brand, this); } _hasBrand() { return !utils.isNull(utils.getPointer(0, this)); } _initBrand() { return utils.initStructAt(0, Brand, this); } set brand(value) { utils.copyFrom(value, utils.getPointer(0, this)); } toString() { return "Type_Enum_" + super.toString(); } }; var Type_Struct = class extends Struct { static { __name(this, "Type_Struct"); } static _capnp = { displayName: "struct", id: "ac3a6f60ef4cc6d3", size: new ObjectSize(24, 1) }; get typeId() { return utils.getUint64(8, this); } set typeId(value) { utils.setUint64(8, value, this); } _adoptBrand(value) { utils.adopt(value, utils.getPointer(0, this)); } _disownBrand() { return utils.disown(this.brand); } get brand() { return utils.getStruct(0, Brand, this); } _hasBrand() { return !utils.isNull(utils.getPointer(0, this)); } _initBrand() { return utils.initStructAt(0, Brand, this); } set brand(value) { utils.copyFrom(value, utils.getPointer(0, this)); } toString() { return "Type_Struct_" + super.toString(); } }; var Type_Interface = class extends Struct { static { __name(this, "Type_Interface"); } static _capnp = { displayName: "interface", id: "ed8bca69f7fb0cbf", size: new ObjectSize(24, 1) }; get typeId() { return utils.getUint64(8, this); } set typeId(value) { utils.setUint64(8, value, this); } _adoptBrand(value) { utils.adopt(value, utils.getPointer(0, this)); } _disownBrand() { return utils.disown(this.brand); } get brand() { return utils.getStruct(0, Brand, this); } _hasBrand() { return !utils.isNull(utils.getPointer(0, this)); } _initBrand() { return utils.initStructAt(0, Brand, this); } set brand(value) { utils.copyFrom(value, utils.getPointer(0, this)); } toString() { return "Type_Interface_" + super.toString(); } }; var Type_AnyPointer_Unconstrained_Which = { /** * truly AnyPointer * */ ANY_KIND: 0, /** * AnyStruct * */ STRUCT: 1, /** * AnyList * */ LIST: 2, /** * Capability * */ CAPABILITY: 3 }; var Type_AnyPointer_Unconstrained = class extends Struct { static { __name(this, "Type_AnyPointer_Unconstrained"); } static ANY_KIND = Type_AnyPointer_Unconstrained_Which.ANY_KIND; static STRUCT = Type_AnyPointer_Unconstrained_Which.STRUCT; static LIST = Type_AnyPointer_Unconstrained_Which.LIST; static CAPABILITY = Type_AnyPointer_Unconstrained_Which.CAPABILITY; static _capnp = { displayName: "unconstrained", id: "8e3b5f79fe593656", size: new ObjectSize(24, 1) }; get _isAnyKind() { return utils.getUint16(10, this) === 0; } set anyKind(_) { utils.setUint16(10, 0, this); } get _isStruct() { return utils.getUint16(10, this) === 1; } set struct(_) { utils.setUint16(10, 1, this); } get _isList() { return utils.getUint16(10, this) === 2; } set list(_) { utils.setUint16(10, 2, this); } get _isCapability() { return utils.getUint16(10, this) === 3; } set capability(_) { utils.setUint16(10, 3, this); } toString() { return "Type_AnyPointer_Unconstrained_" + super.toString(); } which() { return utils.getUint16(10, this); } }; var Type_AnyPointer_Parameter = class extends Struct { static { __name(this, "Type_AnyPointer_Parameter"); } static _capnp = { displayName: "parameter", id: "9dd1f724f4614a85", size: new ObjectSize(24, 1) }; /** * ID of the generic type whose parameter we're referencing. This should be a parent of the * current scope. * */ get scopeId() { return utils.getUint64(16, this); } set scopeId(value) { utils.setUint64(16, value, this); } /** * Index of the parameter within the generic type's parameter list. * */ get parameterIndex() { return utils.getUint16(10, this); } set parameterIndex(value) { utils.setUint16(10, value, this); } toString() { return "Type_AnyPointer_Parameter_" + super.toString(); } }; var Type_AnyPointer_ImplicitMethodParameter = class extends Struct { static { __name(this, "Type_AnyPointer_ImplicitMethodParameter"); } static _capnp = { displayName: "implicitMethodParameter", id: "baefc9120c56e274", size: new ObjectSize(24, 1) }; get parameterIndex() { return utils.getUint16(10, this); } set parameterIndex(value) { utils.setUint16(10, value, this); } toString() { return "Type_AnyPointer_ImplicitMethodParameter_" + super.toString(); } }; var Type_AnyPointer_Which = { /** * A regular AnyPointer. * * The name "unconstrained" means as opposed to constraining it to match a type parameter. * In retrospect this name is probably a poor choice given that it may still be constrained * to be a struct, list, or capability. * */ UNCONSTRAINED: 0, /** * This is actually a reference to a type parameter defined within this scope. * */ PARAMETER: 1, /** * This is actually a reference to an implicit (generic) parameter of a method. The only * legal context for this type to appear is inside Method.paramBrand or Method.resultBrand. * */ IMPLICIT_METHOD_PARAMETER: 2 }; var Type_AnyPointer = class extends Struct { static { __name(this, "Type_AnyPointer"); } static UNCONSTRAINED = Type_AnyPointer_Which.UNCONSTRAINED; static PARAMETER = Type_AnyPointer_Which.PARAMETER; static IMPLICIT_METHOD_PARAMETER = Type_AnyPointer_Which.IMPLICIT_METHOD_PARAMETER; static _capnp = { displayName: "anyPointer", id: "c2573fe8a23e49f1", size: new ObjectSize(24, 1) }; /** * A regular AnyPointer. * * The name "unconstrained" means as opposed to constraining it to match a type parameter. * In retrospect this name is probably a poor choice given that it may still be constrained * to be a struct, list, or capability. * */ get unconstrained() { utils.testWhich("unconstrained", utils.getUint16(8, this), 0, this); return utils.getAs(Type_AnyPointer_Unconstrained, this); } _initUnconstrained() { utils.setUint16(8, 0, this); return utils.getAs(Type_AnyPointer_Unconstrained, this); } get _isUnconstrained() { return utils.getUint16(8, this) === 0; } set unconstrained(_) { utils.setUint16(8, 0, this); } /** * This is actually a reference to a type parameter defined within this scope. * */ get parameter() { utils.testWhich("parameter", utils.getUint16(8, this), 1, this); return utils.getAs(Type_AnyPointer_Parameter, this); } _initParameter() { utils.setUint16(8, 1, this); return utils.getAs(Type_AnyPointer_Parameter, this); } get _isParameter() { return utils.getUint16(8, this) === 1; } set parameter(_) { utils.setUint16(8, 1, this); } /** * This is actually a reference to an implicit (generic) parameter of a method. The only * legal context for this type to appear is inside Method.paramBrand or Method.resultBrand. * */ get implicitMethodParameter() { utils.testWhich("implicitMethodParameter", utils.getUint16(8, this), 2, this); return utils.getAs(Type_AnyPointer_ImplicitMethodParameter, this); } _initImplicitMethodParameter() { utils.setUint16(8, 2, this); return utils.getAs(Type_AnyPointer_ImplicitMethodParameter, this); } get _isImplicitMethodParameter() { return utils.getUint16(8, this) === 2; } set implicitMethodParameter(_) { utils.setUint16(8, 2, this); } toString() { return "Type_AnyPointer_" + super.toString(); } which() { return utils.getUint16(8, this); } }; var Type_Which = { VOID: 0, BOOL: 1, INT8: 2, INT16: 3, INT32: 4, INT64: 5, UINT8: 6, UINT16: 7, UINT32: 8, UINT64: 9, FLOAT32: 10, FLOAT64: 11, TEXT: 12, DATA: 13, LIST: 14, ENUM: 15, STRUCT: 16, INTERFACE: 17, ANY_POINTER: 18 }; var Type = class extends Struct { static { __name(this, "Type"); } static VOID = Type_Which.VOID; static BOOL = Type_Which.BOOL; static INT8 = Type_Which.INT8; static INT16 = Type_Which.INT16; static INT32 = Type_Which.INT32; static INT64 = Type_Which.INT64; static UINT8 = Type_Which.UINT8; static UINT16 = Type_Which.UINT16; static UINT32 = Type_Which.UINT32; static UINT64 = Type_Which.UINT64; static FLOAT32 = Type_Which.FLOAT32; static FLOAT64 = Type_Which.FLOAT64; static TEXT = Type_Which.TEXT; static DATA = Type_Which.DATA; static LIST = Type_Which.LIST; static ENUM = Type_Which.ENUM; static STRUCT = Type_Which.STRUCT; static INTERFACE = Type_Which.INTERFACE; static ANY_POINTER = Type_Which.ANY_POINTER; static _capnp = { displayName: "Type", id: "d07378ede1f9cc60", size: new ObjectSize(24, 1) }; get _isVoid() { return utils.getUint16(0, this) === 0; } set void(_) { utils.setUint16(0, 0, this); } get _isBool() { return utils.getUint16(0, this) === 1; } set bool(_) { utils.setUint16(0, 1, this); } get _isInt8() { return utils.getUint16(0, this) === 2; } set int8(_) { utils.setUint16(0, 2, this); } get _isInt16() { return utils.getUint16(0, this) === 3; } set int16(_) { utils.setUint16(0, 3, this); } get _isInt32() { return utils.getUint16(0, this) === 4; } set int32(_) { utils.setUint16(0, 4, this); } get _isInt64() { return utils.getUint16(0, this) === 5; } set int64(_) { utils.setUint16(0, 5, this); } get _isUint8() { return utils.getUint16(0, this) === 6; } set uint8(_) { utils.setUint16(0, 6, this); } get _isUint16() { return utils.getUint16(0, this) === 7; } set uint16(_) { utils.setUint16(0, 7, this); } get _isUint32() { return utils.getUint16(0, this) === 8; } set uint32(_) { utils.setUint16(0, 8, this); } get _isUint64() { return utils.getUint16(0, this) === 9; } set uint64(_) { utils.setUint16(0, 9, this); } get _isFloat32() { return utils.getUint16(0, this) === 10; } set float32(_) { utils.setUint16(0, 10, this); } get _isFloat64() { return utils.getUint16(0, this) === 11; } set float64(_) { utils.setUint16(0, 11, this); } get _isText() { return utils.getUint16(0, this) === 12; } set text(_) { utils.setUint16(0, 12, this); } get _isData() { return utils.getUint16(0, this) === 13; } set data(_) { utils.setUint16(0, 13, this); } get list() { utils.testWhich("list", utils.getUint16(0, this), 14, this); return utils.getAs(Type_List, this); } _initList() { utils.setUint16(0, 14, this); return utils.getAs(Type_List, this); } get _isList() { return utils.getUint16(0, this) === 14; } set list(_) { utils.setUint16(0, 14, this); } get enum() { utils.testWhich("enum", utils.getUint16(0, this), 15, this); return utils.getAs(Type_Enum, this); } _initEnum() { utils.setUint16(0, 15, this); return utils.getAs(Type_Enum, this); } get _isEnum() { return utils.getUint16(0, this) === 15; } set enum(_) { utils.setUint16(0, 15, this); } get struct() { utils.testWhich("struct", utils.getUint16(0, this), 16, this); return utils.getAs(Type_Struct, this); } _initStruct() { utils.setUint16(0, 16, this); return utils.getAs(Type_Struct, this); } get _isStruct() { return utils.getUint16(0, this) === 16; } set struct(_) { utils.setUint16(0, 16, this); } get interface() { utils.testWhich("interface", utils.getUint16(0, this), 17, this); return utils.getAs(Type_Interface, this); } _initInterface() { utils.setUint16(0, 17, this); return utils.getAs(Type_Interface, this); } get _isInterface() { return utils.getUint16(0, this) === 17; } set interface(_) { utils.setUint16(0, 17, this); } get anyPointer() { utils.testWhich("anyPointer", utils.getUint16(0, this), 18, this); return utils.getAs(Type_AnyPointer, this); } _initAnyPointer() { utils.setUint16(0, 18, this); return utils.getAs(Type_AnyPointer, this); } get _isAnyPointer() { return utils.getUint16(0, this) === 18; } set anyPointer(_) { utils.setUint16(0, 18, this); } toString() { return "Type_" + super.toString(); } which() { return utils.getUint16(0, this); } }; var Brand_Scope_Which = { /** * ID of the scope to which these params apply. * */ BIND: 0, /** * List of parameter bindings. * */ INHERIT: 1 }; var Brand_Scope = class _Brand_Scope extends Struct { static { __name(this, "Brand_Scope"); } static BIND = Brand_Scope_Which.BIND; static INHERIT = Brand_Scope_Which.INHERIT; static _capnp = { displayName: "Scope", id: "abd73485a9636bc9", size: new ObjectSize(16, 1) }; static _Bind; /** * ID of the scope to which these params apply. * */ get scopeId() { return utils.getUint64(0, this); } set scopeId(value) { utils.setUint64(0, value, this); } _adoptBind(value) { utils.setUint16(8, 0, this); utils.adopt(value, utils.getPointer(0, this)); } _disownBind() { return utils.disown(this.bind); } /** * List of parameter bindings. * */ get bind() { utils.testWhich("bind", utils.getUint16(8, this), 0, this); return utils.getList(0, _Brand_Scope._Bind, this); } _hasBind() { return !utils.isNull(utils.getPointer(0, this)); } _initBind(length) { utils.setUint16(8, 0, this); return utils.initList(0, _Brand_Scope._Bind, length, this); } get _isBind() { return utils.getUint16(8, this) === 0; } set bind(value) { utils.setUint16(8, 0, this); utils.copyFrom(value, utils.getPointer(0, this)); } get _isInherit() { return utils.getUint16(8, this) === 1; } set inherit(_) { utils.setUint16(8, 1, this); } toString() { return "Brand_Scope_" + super.toString(); } which() { return utils.getUint16(8, this); } }; var Brand_Binding_Which = { UNBOUND: 0, TYPE: 1 }; var Brand_Binding = class extends Struct { static { __name(this, "Brand_Binding"); } static UNBOUND = Brand_Binding_Which.UNBOUND; static TYPE = Brand_Binding_Which.TYPE; static _capnp = { displayName: "Binding", id: "c863cd16969ee7fc", si