You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fields rawkind and rawvalue track the original bytes from the token's kind and value, as well as the prefixing spaces (including newlines).
Everything aside from the prefix is redundant w/ the fields like kind and value. This makes for some extra work when updating values or initializing tokens.
Instead, we could rename these fields to valuePrefix and kindPrefix, and keep only the prefixing spaces in them. That would slightly complicate this append in MarshalText() but it seems like it'd be a huge improvement overall.
It would also eliminate the need to do copying on byte slices as they wouldn't be getting modified anymore.
The text was updated successfully, but these errors were encountered:
Here's the current
token
struct:The fields
rawkind
andrawvalue
track the original bytes from the token's kind and value, as well as the prefixing spaces (including newlines).Everything aside from the prefix is redundant w/ the fields like
kind
andvalue
. This makes for some extra work when updating values or initializing tokens.Instead, we could rename these fields to
valuePrefix
andkindPrefix
, and keep only the prefixing spaces in them. That would slightly complicate this append inMarshalText()
but it seems like it'd be a huge improvement overall.It would also eliminate the need to do copying on byte slices as they wouldn't be getting modified anymore.
The text was updated successfully, but these errors were encountered: