Skip to content

Commit

Permalink
Read unknown fields even on empty messages (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcready authored Jan 29, 2025
1 parent 8a508df commit 326fc6d
Showing 1 changed file with 0 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,6 @@ export class InternalBinaryRead implements CustomMethodGenerator {
make(source: TypescriptFile, descriptor: DescriptorProto): ts.MethodDeclaration[] {
const methods: ts.MethodDeclaration[] = [];

// if the message has no fields, we produce a much shorter body:
// return target ?? this.create();
if (descriptor.field.length === 0) {
return [this.makeMethod(source, descriptor,
ts.createReturn(ts.createBinary(
ts.createIdentifier("target"),
ts.createToken(ts.SyntaxKind.QuestionQuestionToken),
ts.createCall(
ts.createPropertyAccess(ts.createThis(), ts.createIdentifier("create")),
undefined, []
)
))
)];
}

// internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ${messageInterfaceId}): ${messageInterfaceId} {
let internalBinaryRead = this.makeMethod(
source,
Expand Down

0 comments on commit 326fc6d

Please sign in to comment.