UNPKG

@stryke/capnp

Version:

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

1,759 lines (1,757 loc) 77.2 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const require_src = require('./src-B6FhDNiV.cjs'); //#region schemas/schema.ts const _capnpFileId = BigInt("0xa93fc509624c72d9"); /** * Information about one of the node's parameters. * */ var Node_Parameter = class extends require_src.Struct { static _capnp = { displayName: "Parameter", id: "b9521bccf10fa3b1", size: new require_src.ObjectSize(0, 1) }; get name() { return require_src.utils.getText(0, this); } set name(value) { require_src.utils.setText(0, value, this); } toString() { return "Node_Parameter_" + super.toString(); } }; var Node_NestedNode = class extends require_src.Struct { static _capnp = { displayName: "NestedNode", id: "debf55bbfa0fc242", size: new require_src.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 require_src.utils.getText(0, this); } set name(value) { require_src.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 require_src.utils.getUint64(0, this); } set id(value) { require_src.utils.setUint64(0, value, this); } toString() { return "Node_NestedNode_" + super.toString(); } }; var Node_SourceInfo_Member = class extends require_src.Struct { static _capnp = { displayName: "Member", id: "c2ba9038898e1fa2", size: new require_src.ObjectSize(0, 1) }; /** * Doc comment on the member. * */ get docComment() { return require_src.utils.getText(0, this); } set docComment(value) { require_src.utils.setText(0, value, this); } toString() { return "Node_SourceInfo_Member_" + super.toString(); } }; /** * Additional information about a node which is not needed at runtime, but may be useful for * documentation or debugging purposes. This is kept in a separate struct to make sure it * doesn't accidentally get included in contexts where it is not needed. The * `CodeGeneratorRequest` includes this information in a separate array. * */ var Node_SourceInfo = class Node_SourceInfo extends require_src.Struct { static Member = Node_SourceInfo_Member; static _capnp = { displayName: "SourceInfo", id: "f38e1de3041357ae", size: new require_src.ObjectSize(8, 2) }; static _Members; /** * ID of the Node which this info describes. * */ get id() { return require_src.utils.getUint64(0, this); } set id(value) { require_src.utils.setUint64(0, value, this); } /** * The top-level doc comment for the Node. * */ get docComment() { return require_src.utils.getText(0, this); } set docComment(value) { require_src.utils.setText(0, value, this); } _adoptMembers(value) { require_src.utils.adopt(value, require_src.utils.getPointer(1, this)); } _disownMembers() { return require_src.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 require_src.utils.getList(1, Node_SourceInfo._Members, this); } _hasMembers() { return !require_src.utils.isNull(require_src.utils.getPointer(1, this)); } _initMembers(length) { return require_src.utils.initList(1, Node_SourceInfo._Members, length, this); } set members(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(1, this)); } toString() { return "Node_SourceInfo_" + super.toString(); } }; var Node_Struct = class Node_Struct extends require_src.Struct { static _capnp = { displayName: "struct", id: "9ea0b19b37fb4435", size: new require_src.ObjectSize(40, 6) }; static _Fields; /** * Size of the data section, in words. * */ get dataWordCount() { return require_src.utils.getUint16(14, this); } set dataWordCount(value) { require_src.utils.setUint16(14, value, this); } /** * Size of the pointer section, in pointers (which are one word each). * */ get pointerCount() { return require_src.utils.getUint16(24, this); } set pointerCount(value) { require_src.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 require_src.utils.getUint16(26, this); } set preferredListEncoding(value) { require_src.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 require_src.utils.getBit(224, this); } set isGroup(value) { require_src.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 require_src.utils.getUint16(30, this); } set discriminantCount(value) { require_src.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 require_src.utils.getUint32(32, this); } set discriminantOffset(value) { require_src.utils.setUint32(32, value, this); } _adoptFields(value) { require_src.utils.adopt(value, require_src.utils.getPointer(3, this)); } _disownFields() { return require_src.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 require_src.utils.getList(3, Node_Struct._Fields, this); } _hasFields() { return !require_src.utils.isNull(require_src.utils.getPointer(3, this)); } _initFields(length) { return require_src.utils.initList(3, Node_Struct._Fields, length, this); } set fields(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(3, this)); } toString() { return "Node_Struct_" + super.toString(); } }; var Node_Enum = class Node_Enum extends require_src.Struct { static _capnp = { displayName: "enum", id: "b54ab3364333f598", size: new require_src.ObjectSize(40, 6) }; static _Enumerants; _adoptEnumerants(value) { require_src.utils.adopt(value, require_src.utils.getPointer(3, this)); } _disownEnumerants() { return require_src.utils.disown(this.enumerants); } /** * Enumerants ordered by numeric value (ordinal). * */ get enumerants() { return require_src.utils.getList(3, Node_Enum._Enumerants, this); } _hasEnumerants() { return !require_src.utils.isNull(require_src.utils.getPointer(3, this)); } _initEnumerants(length) { return require_src.utils.initList(3, Node_Enum._Enumerants, length, this); } set enumerants(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(3, this)); } toString() { return "Node_Enum_" + super.toString(); } }; var Node_Interface = class Node_Interface extends require_src.Struct { static _capnp = { displayName: "interface", id: "e82753cff0c2218f", size: new require_src.ObjectSize(40, 6) }; static _Methods; static _Superclasses; _adoptMethods(value) { require_src.utils.adopt(value, require_src.utils.getPointer(3, this)); } _disownMethods() { return require_src.utils.disown(this.methods); } /** * Methods ordered by ordinal. * */ get methods() { return require_src.utils.getList(3, Node_Interface._Methods, this); } _hasMethods() { return !require_src.utils.isNull(require_src.utils.getPointer(3, this)); } _initMethods(length) { return require_src.utils.initList(3, Node_Interface._Methods, length, this); } set methods(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(3, this)); } _adoptSuperclasses(value) { require_src.utils.adopt(value, require_src.utils.getPointer(4, this)); } _disownSuperclasses() { return require_src.utils.disown(this.superclasses); } /** * Superclasses of this interface. * */ get superclasses() { return require_src.utils.getList(4, Node_Interface._Superclasses, this); } _hasSuperclasses() { return !require_src.utils.isNull(require_src.utils.getPointer(4, this)); } _initSuperclasses(length) { return require_src.utils.initList(4, Node_Interface._Superclasses, length, this); } set superclasses(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(4, this)); } toString() { return "Node_Interface_" + super.toString(); } }; var Node_Const = class extends require_src.Struct { static _capnp = { displayName: "const", id: "b18aa5ac7a0d9420", size: new require_src.ObjectSize(40, 6) }; _adoptType(value) { require_src.utils.adopt(value, require_src.utils.getPointer(3, this)); } _disownType() { return require_src.utils.disown(this.type); } get type() { return require_src.utils.getStruct(3, Type, this); } _hasType() { return !require_src.utils.isNull(require_src.utils.getPointer(3, this)); } _initType() { return require_src.utils.initStructAt(3, Type, this); } set type(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(3, this)); } _adoptValue(value) { require_src.utils.adopt(value, require_src.utils.getPointer(4, this)); } _disownValue() { return require_src.utils.disown(this.value); } get value() { return require_src.utils.getStruct(4, Value, this); } _hasValue() { return !require_src.utils.isNull(require_src.utils.getPointer(4, this)); } _initValue() { return require_src.utils.initStructAt(4, Value, this); } set value(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(4, this)); } toString() { return "Node_Const_" + super.toString(); } }; var Node_Annotation = class extends require_src.Struct { static _capnp = { displayName: "annotation", id: "ec1619d4400a0290", size: new require_src.ObjectSize(40, 6) }; _adoptType(value) { require_src.utils.adopt(value, require_src.utils.getPointer(3, this)); } _disownType() { return require_src.utils.disown(this.type); } get type() { return require_src.utils.getStruct(3, Type, this); } _hasType() { return !require_src.utils.isNull(require_src.utils.getPointer(3, this)); } _initType() { return require_src.utils.initStructAt(3, Type, this); } set type(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(3, this)); } get targetsFile() { return require_src.utils.getBit(112, this); } set targetsFile(value) { require_src.utils.setBit(112, value, this); } get targetsConst() { return require_src.utils.getBit(113, this); } set targetsConst(value) { require_src.utils.setBit(113, value, this); } get targetsEnum() { return require_src.utils.getBit(114, this); } set targetsEnum(value) { require_src.utils.setBit(114, value, this); } get targetsEnumerant() { return require_src.utils.getBit(115, this); } set targetsEnumerant(value) { require_src.utils.setBit(115, value, this); } get targetsStruct() { return require_src.utils.getBit(116, this); } set targetsStruct(value) { require_src.utils.setBit(116, value, this); } get targetsField() { return require_src.utils.getBit(117, this); } set targetsField(value) { require_src.utils.setBit(117, value, this); } get targetsUnion() { return require_src.utils.getBit(118, this); } set targetsUnion(value) { require_src.utils.setBit(118, value, this); } get targetsGroup() { return require_src.utils.getBit(119, this); } set targetsGroup(value) { require_src.utils.setBit(119, value, this); } get targetsInterface() { return require_src.utils.getBit(120, this); } set targetsInterface(value) { require_src.utils.setBit(120, value, this); } get targetsMethod() { return require_src.utils.getBit(121, this); } set targetsMethod(value) { require_src.utils.setBit(121, value, this); } get targetsParam() { return require_src.utils.getBit(122, this); } set targetsParam(value) { require_src.utils.setBit(122, value, this); } get targetsAnnotation() { return require_src.utils.getBit(123, this); } set targetsAnnotation(value) { require_src.utils.setBit(123, value, this); } toString() { return "Node_Annotation_" + super.toString(); } }; const 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 require_src.Struct { 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 require_src.ObjectSize(40, 6) }; static _Parameters; static _NestedNodes; static _Annotations; get id() { return require_src.utils.getUint64(0, this); } set id(value) { require_src.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 require_src.utils.getText(0, this); } set displayName(value) { require_src.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 require_src.utils.getUint32(8, this); } set displayNamePrefixLength(value) { require_src.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 require_src.utils.getUint64(16, this); } set scopeId(value) { require_src.utils.setUint64(16, value, this); } _adoptParameters(value) { require_src.utils.adopt(value, require_src.utils.getPointer(5, this)); } _disownParameters() { return require_src.utils.disown(this.parameters); } /** * If this node is parameterized (generic), the list of parameters. Empty for non-generic types. * */ get parameters() { return require_src.utils.getList(5, Node._Parameters, this); } _hasParameters() { return !require_src.utils.isNull(require_src.utils.getPointer(5, this)); } _initParameters(length) { return require_src.utils.initList(5, Node._Parameters, length, this); } set parameters(value) { require_src.utils.copyFrom(value, require_src.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 require_src.utils.getBit(288, this); } set isGeneric(value) { require_src.utils.setBit(288, value, this); } _adoptNestedNodes(value) { require_src.utils.adopt(value, require_src.utils.getPointer(1, this)); } _disownNestedNodes() { return require_src.utils.disown(this.nestedNodes); } /** * List of nodes nested within this node, along with the names under which they were declared. * */ get nestedNodes() { return require_src.utils.getList(1, Node._NestedNodes, this); } _hasNestedNodes() { return !require_src.utils.isNull(require_src.utils.getPointer(1, this)); } _initNestedNodes(length) { return require_src.utils.initList(1, Node._NestedNodes, length, this); } set nestedNodes(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(1, this)); } _adoptAnnotations(value) { require_src.utils.adopt(value, require_src.utils.getPointer(2, this)); } _disownAnnotations() { return require_src.utils.disown(this.annotations); } /** * Annotations applied to this node. * */ get annotations() { return require_src.utils.getList(2, Node._Annotations, this); } _hasAnnotations() { return !require_src.utils.isNull(require_src.utils.getPointer(2, this)); } _initAnnotations(length) { return require_src.utils.initList(2, Node._Annotations, length, this); } set annotations(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(2, this)); } get _isFile() { return require_src.utils.getUint16(12, this) === 0; } set file(_) { require_src.utils.setUint16(12, 0, this); } get struct() { require_src.utils.testWhich("struct", require_src.utils.getUint16(12, this), 1, this); return require_src.utils.getAs(Node_Struct, this); } _initStruct() { require_src.utils.setUint16(12, 1, this); return require_src.utils.getAs(Node_Struct, this); } get _isStruct() { return require_src.utils.getUint16(12, this) === 1; } set struct(_) { require_src.utils.setUint16(12, 1, this); } get enum() { require_src.utils.testWhich("enum", require_src.utils.getUint16(12, this), 2, this); return require_src.utils.getAs(Node_Enum, this); } _initEnum() { require_src.utils.setUint16(12, 2, this); return require_src.utils.getAs(Node_Enum, this); } get _isEnum() { return require_src.utils.getUint16(12, this) === 2; } set enum(_) { require_src.utils.setUint16(12, 2, this); } get interface() { require_src.utils.testWhich("interface", require_src.utils.getUint16(12, this), 3, this); return require_src.utils.getAs(Node_Interface, this); } _initInterface() { require_src.utils.setUint16(12, 3, this); return require_src.utils.getAs(Node_Interface, this); } get _isInterface() { return require_src.utils.getUint16(12, this) === 3; } set interface(_) { require_src.utils.setUint16(12, 3, this); } get const() { require_src.utils.testWhich("const", require_src.utils.getUint16(12, this), 4, this); return require_src.utils.getAs(Node_Const, this); } _initConst() { require_src.utils.setUint16(12, 4, this); return require_src.utils.getAs(Node_Const, this); } get _isConst() { return require_src.utils.getUint16(12, this) === 4; } set const(_) { require_src.utils.setUint16(12, 4, this); } get annotation() { require_src.utils.testWhich("annotation", require_src.utils.getUint16(12, this), 5, this); return require_src.utils.getAs(Node_Annotation, this); } _initAnnotation() { require_src.utils.setUint16(12, 5, this); return require_src.utils.getAs(Node_Annotation, this); } get _isAnnotation() { return require_src.utils.getUint16(12, this) === 5; } set annotation(_) { require_src.utils.setUint16(12, 5, this); } toString() { return "Node_" + super.toString(); } which() { return require_src.utils.getUint16(12, this); } }; /** * A regular, non-group, non-fixed-list field. * */ var Field_Slot = class extends require_src.Struct { static _capnp = { displayName: "slot", id: "c42305476bb4746f", size: new require_src.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 require_src.utils.getUint32(4, this); } set offset(value) { require_src.utils.setUint32(4, value, this); } _adoptType(value) { require_src.utils.adopt(value, require_src.utils.getPointer(2, this)); } _disownType() { return require_src.utils.disown(this.type); } get type() { return require_src.utils.getStruct(2, Type, this); } _hasType() { return !require_src.utils.isNull(require_src.utils.getPointer(2, this)); } _initType() { return require_src.utils.initStructAt(2, Type, this); } set type(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(2, this)); } _adoptDefaultValue(value) { require_src.utils.adopt(value, require_src.utils.getPointer(3, this)); } _disownDefaultValue() { return require_src.utils.disown(this.defaultValue); } get defaultValue() { return require_src.utils.getStruct(3, Value, this); } _hasDefaultValue() { return !require_src.utils.isNull(require_src.utils.getPointer(3, this)); } _initDefaultValue() { return require_src.utils.initStructAt(3, Value, this); } set defaultValue(value) { require_src.utils.copyFrom(value, require_src.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 require_src.utils.getBit(128, this); } set hadExplicitDefault(value) { require_src.utils.setBit(128, value, this); } toString() { return "Field_Slot_" + super.toString(); } }; /** * A group. * */ var Field_Group = class extends require_src.Struct { static _capnp = { displayName: "group", id: "cafccddb68db1d11", size: new require_src.ObjectSize(24, 4) }; /** * The ID of the group's node. * */ get typeId() { return require_src.utils.getUint64(16, this); } set typeId(value) { require_src.utils.setUint64(16, value, this); } toString() { return "Field_Group_" + super.toString(); } }; const 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 require_src.Struct { static IMPLICIT = Field_Ordinal_Which.IMPLICIT; static EXPLICIT = Field_Ordinal_Which.EXPLICIT; static _capnp = { displayName: "ordinal", id: "bb90d5c287870be6", size: new require_src.ObjectSize(24, 4) }; get _isImplicit() { return require_src.utils.getUint16(10, this) === 0; } set implicit(_) { require_src.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() { require_src.utils.testWhich("explicit", require_src.utils.getUint16(10, this), 1, this); return require_src.utils.getUint16(12, this); } get _isExplicit() { return require_src.utils.getUint16(10, this) === 1; } set explicit(value) { require_src.utils.setUint16(10, 1, this); require_src.utils.setUint16(12, value, this); } toString() { return "Field_Ordinal_" + super.toString(); } which() { return require_src.utils.getUint16(10, this); } }; const 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 }; /** * Schema for a field of a struct. * */ var Field = class Field extends require_src.Struct { static NO_DISCRIMINANT = 65535; static SLOT = Field_Which.SLOT; static GROUP = Field_Which.GROUP; static _capnp = { displayName: "Field", id: "9aad50a41f4af45f", size: new require_src.ObjectSize(24, 4), defaultDiscriminantValue: require_src.getUint16Mask(65535) }; static _Annotations; get name() { return require_src.utils.getText(0, this); } set name(value) { require_src.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 require_src.utils.getUint16(0, this); } set codeOrder(value) { require_src.utils.setUint16(0, value, this); } _adoptAnnotations(value) { require_src.utils.adopt(value, require_src.utils.getPointer(1, this)); } _disownAnnotations() { return require_src.utils.disown(this.annotations); } get annotations() { return require_src.utils.getList(1, Field._Annotations, this); } _hasAnnotations() { return !require_src.utils.isNull(require_src.utils.getPointer(1, this)); } _initAnnotations(length) { return require_src.utils.initList(1, Field._Annotations, length, this); } set annotations(value) { require_src.utils.copyFrom(value, require_src.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 require_src.utils.getUint16(2, this, Field._capnp.defaultDiscriminantValue); } set discriminantValue(value) { require_src.utils.setUint16(2, value, this, Field._capnp.defaultDiscriminantValue); } /** * A regular, non-group, non-fixed-list field. * */ get slot() { require_src.utils.testWhich("slot", require_src.utils.getUint16(8, this), 0, this); return require_src.utils.getAs(Field_Slot, this); } _initSlot() { require_src.utils.setUint16(8, 0, this); return require_src.utils.getAs(Field_Slot, this); } get _isSlot() { return require_src.utils.getUint16(8, this) === 0; } set slot(_) { require_src.utils.setUint16(8, 0, this); } /** * A group. * */ get group() { require_src.utils.testWhich("group", require_src.utils.getUint16(8, this), 1, this); return require_src.utils.getAs(Field_Group, this); } _initGroup() { require_src.utils.setUint16(8, 1, this); return require_src.utils.getAs(Field_Group, this); } get _isGroup() { return require_src.utils.getUint16(8, this) === 1; } set group(_) { require_src.utils.setUint16(8, 1, this); } get ordinal() { return require_src.utils.getAs(Field_Ordinal, this); } _initOrdinal() { return require_src.utils.getAs(Field_Ordinal, this); } toString() { return "Field_" + super.toString(); } which() { return require_src.utils.getUint16(8, this); } }; /** * Schema for member of an enum. * */ var Enumerant = class Enumerant extends require_src.Struct { static _capnp = { displayName: "Enumerant", id: "978a7cebdc549a4d", size: new require_src.ObjectSize(8, 2) }; static _Annotations; get name() { return require_src.utils.getText(0, this); } set name(value) { require_src.utils.setText(0, value, this); } /** * Specifies order in which the enumerants were declared in the code. * Like utils.Field.codeOrder. * */ get codeOrder() { return require_src.utils.getUint16(0, this); } set codeOrder(value) { require_src.utils.setUint16(0, value, this); } _adoptAnnotations(value) { require_src.utils.adopt(value, require_src.utils.getPointer(1, this)); } _disownAnnotations() { return require_src.utils.disown(this.annotations); } get annotations() { return require_src.utils.getList(1, Enumerant._Annotations, this); } _hasAnnotations() { return !require_src.utils.isNull(require_src.utils.getPointer(1, this)); } _initAnnotations(length) { return require_src.utils.initList(1, Enumerant._Annotations, length, this); } set annotations(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(1, this)); } toString() { return "Enumerant_" + super.toString(); } }; var Superclass = class extends require_src.Struct { static _capnp = { displayName: "Superclass", id: "a9962a9ed0a4d7f8", size: new require_src.ObjectSize(8, 1) }; get id() { return require_src.utils.getUint64(0, this); } set id(value) { require_src.utils.setUint64(0, value, this); } _adoptBrand(value) { require_src.utils.adopt(value, require_src.utils.getPointer(0, this)); } _disownBrand() { return require_src.utils.disown(this.brand); } get brand() { return require_src.utils.getStruct(0, Brand, this); } _hasBrand() { return !require_src.utils.isNull(require_src.utils.getPointer(0, this)); } _initBrand() { return require_src.utils.initStructAt(0, Brand, this); } set brand(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(0, this)); } toString() { return "Superclass_" + super.toString(); } }; /** * Schema for method of an interface. * */ var Method = class Method extends require_src.Struct { static _capnp = { displayName: "Method", id: "9500cce23b334d80", size: new require_src.ObjectSize(24, 5) }; static _ImplicitParameters; static _Annotations; get name() { return require_src.utils.getText(0, this); } set name(value) { require_src.utils.setText(0, value, this); } /** * Specifies order in which the methods were declared in the code. * Like utils.Field.codeOrder. * */ get codeOrder() { return require_src.utils.getUint16(0, this); } set codeOrder(value) { require_src.utils.setUint16(0, value, this); } _adoptImplicitParameters(value) { require_src.utils.adopt(value, require_src.utils.getPointer(4, this)); } _disownImplicitParameters() { return require_src.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 require_src.utils.getList(4, Method._ImplicitParameters, this); } _hasImplicitParameters() { return !require_src.utils.isNull(require_src.utils.getPointer(4, this)); } _initImplicitParameters(length) { return require_src.utils.initList(4, Method._ImplicitParameters, length, this); } set implicitParameters(value) { require_src.utils.copyFrom(value, require_src.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 require_src.utils.getUint64(8, this); } set paramStructType(value) { require_src.utils.setUint64(8, value, this); } _adoptParamBrand(value) { require_src.utils.adopt(value, require_src.utils.getPointer(2, this)); } _disownParamBrand() { return require_src.utils.disown(this.paramBrand); } /** * Brand of param struct type. * */ get paramBrand() { return require_src.utils.getStruct(2, Brand, this); } _hasParamBrand() { return !require_src.utils.isNull(require_src.utils.getPointer(2, this)); } _initParamBrand() { return require_src.utils.initStructAt(2, Brand, this); } set paramBrand(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(2, this)); } /** * ID of the return struct type; similar to `paramStructType`. * */ get resultStructType() { return require_src.utils.getUint64(16, this); } set resultStructType(value) { require_src.utils.setUint64(16, value, this); } _adoptResultBrand(value) { require_src.utils.adopt(value, require_src.utils.getPointer(3, this)); } _disownResultBrand() { return require_src.utils.disown(this.resultBrand); } /** * Brand of result struct type. * */ get resultBrand() { return require_src.utils.getStruct(3, Brand, this); } _hasResultBrand() { return !require_src.utils.isNull(require_src.utils.getPointer(3, this)); } _initResultBrand() { return require_src.utils.initStructAt(3, Brand, this); } set resultBrand(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(3, this)); } _adoptAnnotations(value) { require_src.utils.adopt(value, require_src.utils.getPointer(1, this)); } _disownAnnotations() { return require_src.utils.disown(this.annotations); } get annotations() { return require_src.utils.getList(1, Method._Annotations, this); } _hasAnnotations() { return !require_src.utils.isNull(require_src.utils.getPointer(1, this)); } _initAnnotations(length) { return require_src.utils.initList(1, Method._Annotations, length, this); } set annotations(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(1, this)); } toString() { return "Method_" + super.toString(); } }; var Type_List = class extends require_src.Struct { static _capnp = { displayName: "list", id: "87e739250a60ea97", size: new require_src.ObjectSize(24, 1) }; _adoptElementType(value) { require_src.utils.adopt(value, require_src.utils.getPointer(0, this)); } _disownElementType() { return require_src.utils.disown(this.elementType); } get elementType() { return require_src.utils.getStruct(0, Type, this); } _hasElementType() { return !require_src.utils.isNull(require_src.utils.getPointer(0, this)); } _initElementType() { return require_src.utils.initStructAt(0, Type, this); } set elementType(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(0, this)); } toString() { return "Type_List_" + super.toString(); } }; var Type_Enum = class extends require_src.Struct { static _capnp = { displayName: "enum", id: "9e0e78711a7f87a9", size: new require_src.ObjectSize(24, 1) }; get typeId() { return require_src.utils.getUint64(8, this); } set typeId(value) { require_src.utils.setUint64(8, value, this); } _adoptBrand(value) { require_src.utils.adopt(value, require_src.utils.getPointer(0, this)); } _disownBrand() { return require_src.utils.disown(this.brand); } get brand() { return require_src.utils.getStruct(0, Brand, this); } _hasBrand() { return !require_src.utils.isNull(require_src.utils.getPointer(0, this)); } _initBrand() { return require_src.utils.initStructAt(0, Brand, this); } set brand(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(0, this)); } toString() { return "Type_Enum_" + super.toString(); } }; var Type_Struct = class extends require_src.Struct { static _capnp = { displayName: "struct", id: "ac3a6f60ef4cc6d3", size: new require_src.ObjectSize(24, 1) }; get typeId() { return require_src.utils.getUint64(8, this); } set typeId(value) { require_src.utils.setUint64(8, value, this); } _adoptBrand(value) { require_src.utils.adopt(value, require_src.utils.getPointer(0, this)); } _disownBrand() { return require_src.utils.disown(this.brand); } get brand() { return require_src.utils.getStruct(0, Brand, this); } _hasBrand() { return !require_src.utils.isNull(require_src.utils.getPointer(0, this)); } _initBrand() { return require_src.utils.initStructAt(0, Brand, this); } set brand(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(0, this)); } toString() { return "Type_Struct_" + super.toString(); } }; var Type_Interface = class extends require_src.Struct { static _capnp = { displayName: "interface", id: "ed8bca69f7fb0cbf", size: new require_src.ObjectSize(24, 1) }; get typeId() { return require_src.utils.getUint64(8, this); } set typeId(value) { require_src.utils.setUint64(8, value, this); } _adoptBrand(value) { require_src.utils.adopt(value, require_src.utils.getPointer(0, this)); } _disownBrand() { return require_src.utils.disown(this.brand); } get brand() { return require_src.utils.getStruct(0, Brand, this); } _hasBrand() { return !require_src.utils.isNull(require_src.utils.getPointer(0, this)); } _initBrand() { return require_src.utils.initStructAt(0, Brand, this); } set brand(value) { require_src.utils.copyFrom(value, require_src.utils.getPointer(0, this)); } toString() { return "Type_Interface_" + super.toString(); } }; const Type_AnyPointer_Unconstrained_Which = { /** * truly AnyPointer * */ ANY_KIND: 0, /** * AnyStruct * */ STRUCT: 1, /** * AnyList * */ LIST: 2, /** * Capability * */ CAPABILITY: 3 }; /** * 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. * */ var Type_AnyPointer_Unconstrained = class extends require_src.Struct { 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 require_src.ObjectSize(24, 1) }; get _isAnyKind() { return require_src.utils.getUint16(10, this) === 0; } set anyKind(_) { require_src.utils.setUint16(10, 0, this); } get _isStruct() { return require_src.utils.getUint16(10, this) === 1; } set struct(_) { require_src.utils.setUint16(10, 1, this); } get _isList() { return require_src.utils.getUint16(10, this) === 2; } set list(_) { require_src.utils.setUint16(10, 2, this); } get _isCapability() { return require_src.utils.getUint16(10, this) === 3; } set capability(_) { require_src.utils.setUint16(10, 3, this); } toString() { return "Type_AnyPointer_Unconstrained_" + super.toString(); } which() { return require_src.utils.getUint16(10, this); } }; /** * This is actually a reference to a type parameter defined within this scope. * */ var Type_AnyPointer_Parameter = class extends require_src.Struct { static _capnp = { displayName: "parameter", id: "9dd1f724f4614a85", size: new require_src.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 require_src.utils.getUint64(16, this); } set scopeId(value) { require_src.utils.setUint64(16, value, this); } /** * Index of the parameter within the generic type's parameter list. * */ get parameterIndex() { return require_src.utils.getUint16(10, this); } set parameterIndex(value) { require_src.utils.setUint16(10, value, this); } toString() { return "Type_AnyPointer_Parameter_" + super.toString(); } }; /** * 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. * */ var Type_AnyPointer_ImplicitMethodParameter = class extends require_src.Struct { static _capnp = { displayName: "implicitMethodParameter", id: "baefc9120c56e274", size: new require_src.ObjectSize(24, 1) }; get parameterIndex() { return require_src.utils.getUint16(10, this); } set parameterIndex(value) { require_src.utils.setUint16(10, value, this); } toString() { return "Type_AnyPointer_ImplicitMethodParameter_" + super.toString(); } }; const 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 require_src.Struct { 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 require_src.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() { require_src.utils.testWhich("unconstrained", require_src.utils.getUint16(8, this), 0, this); return require_src.utils.getAs(Type_AnyPointer_Unconstrained, this); } _initUnconstrained() { require_src.utils.setUint16(8, 0, this); return require_src.utils.getAs(Type_AnyPointer_Unconstrained, this); } get _isUnconstrained() { return require_src.utils.getUint16(8, this) === 0; } set unconstrained(_) { require_src.utils.setUint16(8, 0, this); } /** * This is actually a reference to a type parameter defined within this scope. * */ get parameter() { require_src.utils.testWhich("parameter", require_src.utils.getUint16(8, this), 1, this); return require_src.utils.getAs(Type_AnyPointer_Parameter, this); } _initParameter() { require_src.utils.setUint16(8, 1, this); return require_src.utils.getAs(Type_AnyPointer_Parameter, this); } get _isParameter() { return require_src.utils.getUint16(8, this) === 1; } set parameter(_) { require_src.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() { require_src.utils.testWhich("implicitMethodParameter", require_src.utils.getUint16(8, this), 2, this); return require_src.utils.getAs(Type_AnyPointer_ImplicitMethodParameter, this); } _initImplicitMethodParameter() { require_src.utils.setUint16(8, 2, this); return require_src.utils.getAs(Type_AnyPointer_ImplicitMethodParameter, this); } get _isImplicitMethodParameter() { return require_src.utils.getUint16(8, this) === 2; } set implicitMethodParameter(_) { require_src.utils.setUint16(8, 2, this); } toString() { return "Type_AnyPointer_" + super.toString(); } which() { return require_src.utils.getUint16(8, this); } }; const 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 }; /** * Represents a type expression. * */ var Type = class extends require_src.Struct { 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 require_src.ObjectSize(24, 1) }; get _isVoid() { return require_src.utils.getUint16(0, this) === 0; } set void(_) { require_src.utils.setUint16(0, 0, this); } get _isBool() { return require_src.utils.getUint16(0, this) === 1; } set bool(_) { require_src.utils.setUint16(0, 1, this); } get _isInt8() { return require_src.utils.getUint16(0, this) === 2; } set int8(_) { require_src.utils.setUint16(0, 2, this); } get _isInt16() { return require_src.utils.getUint16(0, this) === 3; } set int16(_) { require_src.utils.setUint16(0, 3, this); } get _isInt32() { return require_src.utils.getUint16(0, this) === 4; } set int32(_) { require_src.utils.setUint16(0, 4, this); } get _isInt64() { return require_src.utils.getUint16(0, this) === 5; } set int64(_) { require_src.utils.setUint16(0, 5, this); } get _isUint8() { return require_src.utils.getUint16(0, this) === 6; } set uint8(_) { require_src.utils.setUint16(0, 6, this); } get _isUint16() { return require_src.utils.getUint16(0, this) === 7; } set uint16(_) { require_src.utils.setUint16(0, 7, this); } get _isUint32() { return require_src.utils.getUint16(0, this) === 8; } set uint32(_) { require_src.utils.setUint16(0, 8, this); } get _isUint64() { return require_src.utils.getUint16(0, this) === 9; } set uint64(_) { require_src.utils.setUint16(0, 9, this); } get _isFloat32() { return require_src.utils.getUint16(0, this) === 10; } set float32(_) { require_src.utils.setUint16(0, 10, this); } get _isFloat64() { return require_src.utils.getUint16(0, this) === 11; } set float64(_) { require_src.utils.setUint16(0, 11, this); } get _isText() { return require_src.utils.getUint16(0, this) === 12; } set text(_) { require_src.utils.setUint16(0, 12, this); } get _isData() { return require_src.utils.getUint16(0, this) === 13; } set data(_) { require_src.utils.setUint16(0, 13, this); } get list() { require_src.utils.testWhich("list", require_src.utils.getUint16(0, this), 14, this); return require_src.utils.getAs(Type_List, this); } _initList() { require_src.utils.setUint16(0, 14, this); return require_src.utils.getAs(Type_List, this); }