Skip to content

Commit

Permalink
Remove commented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
Primetalk committed May 8, 2024
1 parent 8690ffa commit 53daedb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,46 +385,7 @@ object ConstructDecoded {
'{EmptyTuple}
} else if (tpe <:< TypeRepr.of[Tuple]) {
'{scala.runtime.Tuples.fromIArray(IArray(${Varargs(terms)})).asInstanceOf[T]}
// Alternative version:
// val t =
// Varargs
// Type.of[T] match {
// case '[h *: t] =>
// val construct = Type.of[t] match {
// case '[EmptyTuple] =>
// println(" ConstructDecoded: t=et")
// Apply(
// TypeApply(
// Select(New(TypeTree.of[Tuple1[h]]), constructor),
// types.map { tpe =>
// tpe match {
// case '[tt] => TypeTree.of[tt]
// }
// }
// ),
// terms.map(_.asTerm)
// )
// case _ =>
// val typeTrees = types.map { tpe =>
// tpe match {
// case '[tt] => TypeTree.of[tt]
// }
// }
// val terms2 = terms.map(_.asTerm)
// val ttt = TypeTree.of[T]

// println(s" ConstructDecoded: t=t; ttt = $ttt; typeTrees = $typeTrees; terms2 = $terms2")
// Apply(
// Select(New(TypeTree.of[IArray[Object]]), constructor),
// // VarArgs
// terms2
// )
// }
// println(s"=========== Create from Tuple Constructor: Tree: $construct ===========")
// println(s"=========== Create from Tuple Constructor ${Format.Expr(construct.asExprOf[T])} ===========")
// construct.asExprOf[T]
// // If we are a case class with no generic parameters, we can easily construct it
// }
// If we are a case class with no generic parameters, we can easily construct it
} else if (tpe.classSymbol.exists(_.flags.is(Flags.Case)) && !constructor.paramSymss.exists(_.exists(_.isTypeParam))) {
val construct =
Apply(
Expand Down
20 changes: 3 additions & 17 deletions quill-sql/src/main/scala/io/getquill/parser/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -199,21 +199,9 @@ object ArbitraryTupleConstructionInlined {
t match {
case
Inlined(
// Some(Apply(
// TypeApply(
// Select(
// Inlined(_,_,
// Typed(AsInstanceOf(TupleCons(a,b)), _)
// ),
// "*:"
// ),
// _
// ),
// _
// )),
_,
List(ValDef("Tuple_this", _, Some(prevTuple))),
Typed(AsInstanceOf(TupleCons(head, TIdent("Tuple_this"))), _)
_,
List(ValDef("Tuple_this", _, Some(prevTuple))),
Typed(AsInstanceOf(TupleCons(head, TIdent("Tuple_this"))), _)
) =>
Some((head, prevTuple))
case _ => None
Expand Down Expand Up @@ -254,7 +242,6 @@ class ArbitraryTupleBlockParser(val rootParse: Parser)(using Quotes, TranspileCo
val aAst = rootParse(a)
ast.Tuple(List(aAst))
case inlined@Unseal(ArbitraryTupleConstructionInlined(singleValue, prevTuple)) =>
//printExpr(inlined, "singleValue ArbitraryTupleConstructionInlined")
val headAst = rootParse(singleValue.asExpr)
val prevTupleAst = rootParse(prevTuple.asExpr)
prevTupleAst match {
Expand All @@ -263,7 +250,6 @@ class ArbitraryTupleBlockParser(val rootParse: Parser)(using Quotes, TranspileCo
throw IllegalArgumentException(s"Unexpected tuple ast ${prevTupleAst}")
}
case block@Unseal(TBlock(parts, ArbitraryTupleConstructionInlined(head,Typed(AsInstanceOf(TupleCons(head2,TIdent("Tuple_this"))), _)) )) if (parts.length > 0) =>
//println(s"Large block. parts.size=${parts.size}; parts:\n- ${parts.mkString("\n- ")}")
val headAst = rootParse(head.asExpr)
val head2Ast = rootParse(head2.asExpr)
val partsAsts = headAst :: head2Ast :: parts.reverse.flatMap{
Expand Down

0 comments on commit 53daedb

Please sign in to comment.