Skip to content

Commit

Permalink
Fix jstype = JS_STRING field option for speed optimized code
Browse files Browse the repository at this point in the history
There was a bug in internal-binary-read.ts

When the field option jstype = JS_STRING was set, the generated method `internalBinaryRead` would still read the field as a bigint.

This problem only surfaces if the plugin parameter long_type_string is *not* set and code is optimized for speed (instead of for code size).
  • Loading branch information
timostamm committed Nov 19, 2020
1 parent 0b53103 commit 360a6c7
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -949,11 +949,8 @@ export class InternalBinaryRead implements CustomMethodGenerator {
if (!Interpreter.isLongValueType(type)) {
return readerMethodCall;
}
if (longType === undefined) {
longType = this.options.normalLongType;
}
let convertMethodProp;
switch (longType) {
switch (longType ?? rt.LongType.STRING) {
case rt.LongType.STRING:
convertMethodProp = ts.createPropertyAccess(readerMethodCall, ts.createIdentifier('toString'));
break;
Expand Down

0 comments on commit 360a6c7

Please sign in to comment.