Skip to content

Commit

Permalink
Fully qualify values in CodecJson.derive macro
Browse files Browse the repository at this point in the history
No longer requires users to have to import CodecJson, EncodeJson,
and DecodeJson when using derivation.
  • Loading branch information
adelbertc committed Jul 5, 2015
1 parent 4f13900 commit 31c1bec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/scala/argonaut/internal/Macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Macros extends MacrosCompat {
val encode = materializeEncodeImpl[T](c)
val decode = materializeDecodeImpl[T](c)
c.Expr[CodecJson[T]](q"""
CodecJson.derived[$tpe]($encode, $decode)
_root_.argonaut.CodecJson.derived[$tpe]($encode, $decode)
""")
}

Expand All @@ -38,7 +38,7 @@ object Macros extends MacrosCompat {
}
val methodName = createTermName(c)("jencode" + (fieldCount.toString) + "L")
val expr = c.Expr[EncodeJson[T]]{q"""
EncodeJson.$methodName[$tpe, ..$fieldTypes](toEncode => (..$invocations))(..$decodedNames)
_root_.argonaut.EncodeJson.$methodName[$tpe, ..$fieldTypes](toEncode => (..$invocations))(..$decodedNames)
"""}
//println(expr)
expr
Expand Down Expand Up @@ -74,12 +74,12 @@ object Macros extends MacrosCompat {
}
val methodName = createTermName(c)("jdecode" + (fieldCount.toString) + "L")
val expr = c.Expr[DecodeJson[T]]{q"""
DecodeJson.$methodName[..$fieldTypes, $tpe]((..$functionParameters) => new $tpe(..$parameters))(..$decodedNames)
_root_.argonaut.DecodeJson.$methodName[..$fieldTypes, $tpe]((..$functionParameters) => new $tpe(..$parameters))(..$decodedNames)
"""}
//println(expr)
expr
}
case None => c.abort(c.enclosingPosition, "Could not identify primary constructor for " + tpe)
}
}
}
}

0 comments on commit 31c1bec

Please sign in to comment.