Skip to content

Commit

Permalink
remove [this] in scala-3 source code
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Aug 21, 2024
1 parent 614a051 commit 33ecbe6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions argonaut/shared/src/main/scala-3/argonaut/internal/Macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ object Macros {
new EncodeJson[A] {
implicit def self: EncodeJson[A] = this // for recursive type

private[this] val elemEncoders: Array[EncodeJson[?]] =
private val elemEncoders: Array[EncodeJson[?]] =
Macros.summonEncoders[A.MirroredElemTypes]

override def encode(a: A): Json =
Json.jObject(
createJsonObject(a.asInstanceOf[Product])
)

private[this] def createJsonObject(value: Product): JsonObject = {
private def createJsonObject(value: Product): JsonObject = {
def encodeWith(index: Int)(p: Any): (String, Json) = {
(value.productElementName(index), elemEncoders(index).asInstanceOf[EncodeJson[Any]].apply(p))
}
Expand All @@ -105,12 +105,12 @@ object Macros {
new DecodeJson[A] {
implicit def self: DecodeJson[A] = this // for recursive type

private[this] def decodeWith(index: Int)(c: HCursor): DecodeResult[AnyRef] =
private def decodeWith(index: Int)(c: HCursor): DecodeResult[AnyRef] =
elemDecoders(index).asInstanceOf[DecodeJson[AnyRef]].tryDecode(c.downField(elemLabels(index)))

private[this] def resultIterator(c: HCursor): Iterator[DecodeResult[AnyRef]] =
private def resultIterator(c: HCursor): Iterator[DecodeResult[AnyRef]] =
new AbstractIterator[DecodeResult[AnyRef]] {
private[this] var i: Int = 0
private var i: Int = 0

def hasNext: Boolean = i < elemCount

Expand All @@ -121,12 +121,12 @@ object Macros {
}
}

private[this] val elemLabels = Macros.summonLabels[A.MirroredElemLabels]
private val elemLabels = Macros.summonLabels[A.MirroredElemLabels]

private[this] val elemDecoders: Array[DecodeJson[?]] =
private val elemDecoders: Array[DecodeJson[?]] =
Macros.summonDecoders[A.MirroredElemTypes]

private[this] val elemCount = elemDecoders.size
private val elemCount = elemDecoders.size

override def decode(c: HCursor): DecodeResult[A] = {
DecodeResult[A] {
Expand Down

0 comments on commit 33ecbe6

Please sign in to comment.