Skip to content

Commit

Permalink
Implement copy
Browse files Browse the repository at this point in the history
  • Loading branch information
marmbrus committed Jul 27, 2014
1 parent 3587460 commit 64b2ee1
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] {
}
"""

val copyFunction =
q"""
final def copy() = new $genericRowType(this.toArray)
"""

val classBody =
nullFunctions ++ (
lengthDef +:
Expand All @@ -196,16 +201,12 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] {
updateFunction +:
equalsFunction +:
hashCodeFunction +:
copyFunction +:
(tupleElements ++ specificAccessorFunctions ++ specificMutatorFunctions))

val code = q"""
final class SpecificRow(i: $rowType) extends $mutableRowType {
..$classBody

// Not safe!
final def copy() = scala.sys.error("Not implemented")

final def getStringBuilder(ordinal: Int): StringBuilder = ???
}

new $projectionType { def apply(r: $rowType) = new SpecificRow(r) }
Expand Down

0 comments on commit 64b2ee1

Please sign in to comment.