diff options
author | Martin Odersky <odersky@gmail.com> | 2014-10-11 22:06:17 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-10-12 10:52:02 +0200 |
commit | 74fa107dab3c2442bf14753926bb82f7325645ad (patch) | |
tree | 50bbeb66fab24590061815274eec25d2eaadeba6 | |
parent | 4e897165d9dbd58536a176b9901e0c62457e6b4d (diff) | |
download | dotty-74fa107dab3c2442bf14753926bb82f7325645ad.tar.gz dotty-74fa107dab3c2442bf14753926bb82f7325645ad.tar.bz2 dotty-74fa107dab3c2442bf14753926bb82f7325645ad.zip |
Moved caseAccessors to SymUtils
-rw-r--r-- | src/dotty/tools/dotc/transform/SymUtils.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/SyntheticMethods.scala | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/transform/SymUtils.scala b/src/dotty/tools/dotc/transform/SymUtils.scala index 82bea1813..2875327c4 100644 --- a/src/dotty/tools/dotc/transform/SymUtils.scala +++ b/src/dotty/tools/dotc/transform/SymUtils.scala @@ -51,6 +51,9 @@ class SymUtils(val self: Symbol) extends AnyVal { def accessorNamed(name: TermName)(implicit ctx: Context): Symbol = self.owner.info.decl(name).suchThat(_ is Accessor).symbol + def caseAccessors(implicit ctx:Context) = + self.decls.filter(_ is CaseAccessor).toList + def getter(implicit ctx: Context): Symbol = if (self.isGetter) self else accessorNamed(self.asTerm.name.getterName) diff --git a/src/dotty/tools/dotc/transform/SyntheticMethods.scala b/src/dotty/tools/dotc/transform/SyntheticMethods.scala index 34cca2872..128449efa 100644 --- a/src/dotty/tools/dotc/transform/SyntheticMethods.scala +++ b/src/dotty/tools/dotc/transform/SyntheticMethods.scala @@ -2,7 +2,7 @@ package dotty.tools.dotc package transform import core._ -import Symbols._, Types._, Contexts._, Names._, StdNames._, Constants._ +import Symbols._, Types._, Contexts._, Names._, StdNames._, Constants._, SymUtils._ import scala.collection.{ mutable, immutable } import Flags._ import TreeTransforms._ @@ -48,7 +48,7 @@ class SyntheticMethods extends MiniPhaseTransform with IdentityDenotTransformer */ def syntheticMethods(clazz: ClassSymbol)(implicit ctx: Context): List[Tree] = { val clazzType = clazz.typeRef - def accessors = clazz.decls.filter(_ is CaseAccessor).toList + lazy val accessors = clazz.caseAccessors val symbolsToSynthesize: List[Symbol] = if (clazz.is(Case)) caseSymbols |