@@ -1657,7 +1657,7 @@ object JsonCodecMaker {
1657
1657
discriminator : Option [ReadDiscriminator ],
1658
1658
in : Expr [JsonReader ],
1659
1659
default : Expr [A ],
1660
- )( using Quotes ) : Expr [A ] = {
1660
+ ): Expr [A ] = {
1661
1661
val tpe = types.head
1662
1662
val classInfo = getClassInfo(tpe)
1663
1663
checkFieldNameCollisions(tpe, cfg.discriminatorFieldName.fold(Seq .empty[String ]) { n =>
@@ -1680,12 +1680,11 @@ object JsonCodecMaker {
1680
1680
val rhs = Literal (IntConstant (if (i == lastParamVarIndex) lastParamVarBits else - 1 ))
1681
1681
ValDef (sym, Some (rhs))
1682
1682
}
1683
-
1684
- val checkAndResetFieldPresenceFlags : Map [String , Quotes ?=> Expr [Int ] => Expr [Unit ]] = {
1683
+ val checkAndResetFieldPresenceFlags : Map [String , Expr [Int ] => Expr [Unit ]] = {
1685
1684
classInfo.fields.zipWithIndex.map { case (f, i) =>
1686
1685
val n = Ref (paramVars(i >> 5 ).symbol).asExprOf[Int ]
1687
1686
val m = Expr (1 << i)
1688
- (f.mappedName, (q : Quotes ) ?=> ( l: Expr [Int ]) => ' {
1687
+ (f.mappedName, (l: Expr [Int ]) => ' {
1689
1688
if (($n & $m) != 0 )
1690
1689
$ {Assign (n.asTerm , ' { $n ^ $m }.asTerm).asExprOf[Unit ]}
1691
1690
else
@@ -1779,16 +1778,16 @@ object JsonCodecMaker {
1779
1778
val optDiscriminatorVar = discriminator.map{ _.valDef }
1780
1779
1781
1780
1782
- def blockWithVars [ A : Type ] (next : Expr [ A ])( using Quotes ) : Expr [ A ] =
1781
+ def blockWithVars (next : Term ) : Term =
1783
1782
Block (
1784
1783
readVars.toList ++
1785
1784
paramVars.toList ++
1786
1785
optDiscriminatorVar.toList,
1787
- next.asTerm
1788
- ).asExprOf[ A ]
1786
+ next
1787
+ )
1789
1788
1790
1789
' { if ($in.isNextToken('{' )) {
1791
- $ {blockWithVars[ A ] (
1790
+ $ {blockWithVars(
1792
1791
' {if (! $in.isNextToken('}' )) {
1793
1792
$in.rollbackToken()
1794
1793
var l = - 1
@@ -1799,7 +1798,7 @@ object JsonCodecMaker {
1799
1798
if (! $in.isCurrentToken('}' )) $in.objectEndOrCommaError()
1800
1799
}
1801
1800
$ {Block (checkReqVars.map(_.asTerm), construct).asExprOf[A ]}
1802
- }).asExprOf[A ]
1801
+ }.asTerm ).asExprOf[A ]
1803
1802
}
1804
1803
} else $in.readNullOrTokenError($default, '{' )
1805
1804
}
@@ -1881,7 +1880,7 @@ object JsonCodecMaker {
1881
1880
isStringified : Boolean ,
1882
1881
optDiscriminator : Option [ReadDiscriminator ],
1883
1882
in : Expr [JsonReader ]
1884
- )( using Quotes ) : Expr [C ] = {
1883
+ ): Expr [C ] = {
1885
1884
val tpe = types.head
1886
1885
val implCodec = findImplicitValueCodec(types)
1887
1886
val methodKey = DecoderMethodKey (tpe, isStringified && (isCollection(tpe) || isOption(tpe)), optDiscriminator.isDefined)
@@ -2946,17 +2945,12 @@ object JsonCodecMaker {
2946
2945
2947
2946
val codec = rootTpe.asType match {
2948
2947
case ' [rootType] =>
2949
- def codecExpr ( using Quotes ) = ' {
2948
+ val codecExpr = ' {
2950
2949
new JsonValueCodec [rootType] {
2951
2950
def nullValue : rootType = $ {genNullValue[rootType](rootTpe :: Nil )}
2952
2951
2953
2952
def decodeValue (in : JsonReader , default : rootType): rootType = {
2954
- $ {genReadVal(
2955
- rootTpe :: Nil ,
2956
- ' default ,
2957
- cfg.isStringified,
2958
- None ,
2959
- ' in )}
2953
+ $ {genReadVal(rootTpe :: Nil , ' default , cfg.isStringified, None , ' in )}
2960
2954
}
2961
2955
2962
2956
def encodeValue (x : rootType, out : JsonWriter ): Unit = {
0 commit comments