Skip to content

Commit a4170ae

Browse files
authored
More efficient writing of lists with Scala 2
1 parent 51ab0c7 commit a4170ae

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2068,8 +2068,9 @@ object JsonCodecMaker {
20682068
} else if (tpe <:< typeOf[List[_]]) withEncoderFor(methodKey, m) {
20692069
val tpe1 = typeArg1(tpe)
20702070
q"""out.writeArrayStart()
2071+
val n = _root_.scala.Nil
20712072
var l: _root_.scala.collection.immutable.List[$tpe1] = x
2072-
while (l ne _root_.scala.Nil) {
2073+
while (l ne n) {
20732074
..${genWriteVal(q"l.head", tpe1 :: types, isStringified, EmptyTree)}
20742075
l = l.tail
20752076
}

0 commit comments

Comments
 (0)