mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
style: NapProto
This commit is contained in:
parent
938a84a460
commit
a2c4498694
@ -99,17 +99,18 @@ class NapProtoMsg<T extends ProtoMessageType> {
|
|||||||
this._field = Object.keys(fields).map(key => {
|
this._field = Object.keys(fields).map(key => {
|
||||||
const field = fields[key];
|
const field = fields[key];
|
||||||
if (field.kind === 'scalar') {
|
if (field.kind === 'scalar') {
|
||||||
|
const repeatType = field.repeated
|
||||||
|
? [ScalarType.STRING, ScalarType.BYTES].includes(field.type)
|
||||||
|
? RepeatType.UNPACKED
|
||||||
|
: RepeatType.PACKED
|
||||||
|
: RepeatType.NO;
|
||||||
return {
|
return {
|
||||||
no: field.no,
|
no: field.no,
|
||||||
name: key,
|
name: key,
|
||||||
kind: 'scalar',
|
kind: 'scalar',
|
||||||
T: field.type,
|
T: field.type,
|
||||||
opt: field.optional,
|
opt: field.optional,
|
||||||
repeat: field.repeated
|
repeat: repeatType,
|
||||||
? [ScalarType.STRING, ScalarType.BYTES].includes(field.type)
|
|
||||||
? RepeatType.UNPACKED
|
|
||||||
: RepeatType.PACKED
|
|
||||||
: RepeatType.NO,
|
|
||||||
};
|
};
|
||||||
} else if (field.kind === 'message') {
|
} else if (field.kind === 'message') {
|
||||||
const rt = NapProtoMsgCache.get(field.type()) ?? (() => {
|
const rt = NapProtoMsgCache.get(field.type()) ?? (() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user