Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

Commit

Permalink
Merge branch 'support-for-transient' of github.com:scala/pickling int…
Browse files Browse the repository at this point in the history
…o support-for-transient
  • Loading branch information
heathermiller committed Aug 13, 2014
2 parents c703d5d + 8763c7b commit ecbe614
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions core/src/main/scala/pickling/ir/IRs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class IRs[U <: Universe with Singleton](val uni: U) {
// this part is interesting to unpicklers
def hasSetter = setter.isDefined
def isErasedParam = isParam && accessor.isEmpty // TODO: this should somehow communicate with the constructors phase!
def isReifiedParam = isParam && accessor.nonEmpty
def isNonParam = !isParam
}
case class ClassIR(tpe: Type, parent: ClassIR, fields: List[FieldIR]) extends PickleIR
Expand Down Expand Up @@ -56,10 +55,8 @@ class IRs[U <: Universe with Singleton](val uni: U) {
val (filteredAccessors, transientAccessors) = allAccessors.partition(notMarkedTransient)

val ctorParams = if (ctor != NoSymbol) ctor.asMethod.paramss.flatten.flatMap { sym =>
if (transientAccessors.exists(acc => acc.name.toString == sym.name.toString)) {
//println(s"found a BAD accessor: $sym")
List()
} else List(sym.asTerm)
if (transientAccessors.exists(acc => acc.name.toString == sym.name.toString)) List()
else List(sym.asTerm)
} else Nil

val (paramAccessors, otherAccessors) = allAccessors.partition(_.isParamAccessor)
Expand All @@ -75,16 +72,15 @@ class IRs[U <: Universe with Singleton](val uni: U) {
val varGetters = otherAccessors.collect{ case meth if meth.isGetter && meth.accessed != NoSymbol && meth.accessed.asTerm.isVar => meth }
val varFields = varGetters.map(sym => mkFieldIR(sym, None, Some(sym)))

val res = paramFields ++ varFields
res
paramFields ++ varFields
}

private def composition(f1: (Q, Q) => Q, f2: (C, C) => C, f3: C => List[C]) =
(c: C) => f3(c).reverse.reduce[C](f2)

private val f1 = (q1: Q, q2: Q) => q1 ++ q2

private val f2 = (c1: C, c2: C) => ClassIR(c2.tpe, c1, /*fields(c2.tpe)*/c2.fields) // here: fields is called a 2nd time.
private val f2 = (c1: C, c2: C) => ClassIR(c2.tpe, c1, c2.fields)

private val f3 = (c: C) =>
c.tpe.baseClasses
Expand Down

0 comments on commit ecbe614

Please sign in to comment.