Skip to content

Commit bba9ede

Browse files
authored
Code clean up
1 parent b88a21b commit bba9ede

File tree

1 file changed

+6
-10
lines changed
  • jsoniter-scala-macros/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/macros

1 file changed

+6
-10
lines changed

jsoniter-scala-macros/shared/src/main/scala-2/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodecMaker.scala

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,18 +1567,14 @@ object JsonCodecMaker {
15671567
i += 1""",
15681568
{
15691569
if (isImmutableArraySeq(tpe)) {
1570-
q"""_root_.scala.collection.immutable.ArraySeq.unsafeWrapArray[$tpe1]({
1571-
if (i == l) x
1572-
else $shrinkArray
1573-
})"""
1570+
q"""if (i != l) x = $shrinkArray
1571+
_root_.scala.collection.immutable.ArraySeq.unsafeWrapArray[$tpe1](x)"""
15741572
} else if (isMutableArraySeq(tpe)) {
1575-
q"""_root_.scala.collection.mutable.ArraySeq.make[$tpe1]({
1576-
if (i == l) x
1577-
else $shrinkArray
1578-
})"""
1573+
q"""if (i != l) x = $shrinkArray
1574+
_root_.scala.collection.mutable.ArraySeq.make[$tpe1](x)"""
15791575
} else {
1580-
q"""if (i == l) x
1581-
else $shrinkArray"""
1576+
q"""if (i != l) x = $shrinkArray
1577+
x"""
15821578
}
15831579
})
15841580
} else if (tpe <:< typeOf[immutable.IntMap[_]]) withDecoderFor(methodKey, default) {

0 commit comments

Comments
 (0)