-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add wrapper types for map keys and values #73
Conversation
@@ -127,7 +127,7 @@ private constructor( | |||
<companion()> | |||
<if (nested)> | |||
|
|||
<nested><\\> | |||
<nested:{n | <n>}; separator="\n"><\\> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting cleanup
@@ -62,6 +62,6 @@ deserializeVar(p) ::= <% | |||
|
|||
orDefault(p) ::= <% | |||
<if (isMessage.(p.messageType))> | |||
?: <value.propertyType> {} | |||
<\ >?: <value.propertyType> {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting cleanup
@@ -44,7 +44,7 @@ companion object Deserializer : KtDeserializer\<<name>\> { | |||
|
|||
while (true) { | |||
when (deserializer.readTag()) { | |||
0 -> return <name>(key, value <orDefault(value)>) | |||
0 -> return <name>(key, value<orDefault(value)>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting cleanup
<deserialize:{d | <d.tag> -> <d.assignment.fieldName> = <\\> | ||
<if ((!d.std || d.repeated || d.assignment.long))><\n><t()><endif><\\> | ||
<deserialize:{d | <d.tag> -> <d.assignment.fieldName> =<\\> | ||
<if ((!d.std || d.repeated || d.assignment.long))><\n><t()><else><\ ><endif><\\> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting cleanup
.fold( | ||
{ null }, | ||
{ | ||
resolveMapEntry( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of duplicating this search once annotating, convert it to a message here and extract the fields for later use.
@@ -169,24 +200,40 @@ serializer.write(Tag(<tag>)).write(<box>)<\\> | |||
<endif> | |||
>> | |||
|
|||
deserialize(field, read, lhs, options, packed) ::= << |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the others in this file: removed meaningful whitespace in favor of easier-to-read branch logic, and extracted Map variants.
This revealed that it seems to be a cleaner interface to Wrapper.kt to expose the converter as a nullable type than to try to pass through and replace field accesses. I'll probably revisit the existing wrapper type code and see if that cleans things up a bit, since it's not pretty.
Fixes #26.