mirror of
https://github.com/fankes/moshi.git
synced 2025-10-19 16:09:21 +08:00
Do not check required property for null second time (#732)
* Do not check required property second time * Fix codestyle
This commit is contained in:
committed by
Zac Sweers
parent
0e3a52b729
commit
8a22f6b133
@@ -258,6 +258,8 @@ internal class AdapterGenerator(
|
||||
if (property.differentiateAbsentFromNull) {
|
||||
result.addCode("%2N = if (%3N) %4N else %1N.%2N",
|
||||
resultName, property.name, property.localIsPresentName, property.localName)
|
||||
} else if (property.isRequired) {
|
||||
result.addCode("%1N = %2N", property.name, property.localName)
|
||||
} else {
|
||||
result.addCode("%2N = %3N ?: %1N.%2N", resultName, property.name, property.localName)
|
||||
}
|
||||
|
Reference in New Issue
Block a user