-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use arshal flags instead of coder flags
Instead of consulting the flags on the coder via: export.Encoder(enc).Flags export.Decoder(dec).Flags consult flags on the call-provided arshal options via: mo.Flags uo.Flags This avoids unnecessarily peaking at the internals flags of Encoder or Decoder. There should be no behavior changes as a result of this since the arshal option flags should be identical. There are 6 entry points to the "json" package: * Marshal * MarshalWrite * MarshaEncode * Unmarshal * UnmarshalRead * UnmarshalDecode 4 of them (Marshal, MarshalWrite, Unmarshal, UnmarshalRead) obtain a coder from an internal pool, where the arshal options plumbed down the call stack is identical to the one inside the coder. Therefore, there is no behavior difference for these 4 calls. 2 of them (MarshalEncode, UnmarshalDecode) take in a user-provided coder, where there could theoretically be a difference between the options struct and the coder options. However, in both functions, we obtain a jsonopts.Struct locally from an internal pool and then call jsonopts.Struct.CopyCoderOptions where the coder options are copied from the user-provided coder into the local jsonopts.Struct. Thus, the options struct that we plumb down the stack is gauranteed to be a superset of the options in the user-provided coder.
- Loading branch information
Showing
6 changed files
with
50 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.