aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-06-16 16:27:10 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-16 16:42:54 +0200
commit112f39aa1c3a9e36848b30d7d2709fb1b2ef7949 (patch)
tree5f61e94cc0b8684808431fd6424063907d0690eb /src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
parent4eb107258458801b72e5c34ab4ccf3729b9e12d6 (diff)
downloaddotty-112f39aa1c3a9e36848b30d7d2709fb1b2ef7949.tar.gz
dotty-112f39aa1c3a9e36848b30d7d2709fb1b2ef7949.tar.bz2
dotty-112f39aa1c3a9e36848b30d7d2709fb1b2ef7949.zip
Use FlagSet directly instead of defKind
Instead of classifying class members with a TreeInfo.DefKind, we use directly the flags into which kinds were previously translated.
Diffstat (limited to 'src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala')
-rw-r--r--src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
index 0dfef0c51..44abef435 100644
--- a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
+++ b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
@@ -7,7 +7,6 @@ import Contexts._, Symbols._, Types._, Scopes._, SymDenotations._, Names._, Name
import StdNames._, Denotations._, Flags._, Constants._, Annotations._
import util.Positions._
import ast.{tpd, Trees, untpd}
-import ast.TreeInfo._
import Trees._
import Decorators._
import TastyUnpickler._, TastyBuffer._, PositionPickler._
@@ -351,9 +350,10 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
}
/** Create symbol of definition node and enter in symAtAddr map
- * @return true iff the definition does not contain initialization code
+ * @return the largest subset of {NoInits, PureInterface} that a
+ * trait owning this symbol can have as flags.
*/
- def createSymbol()(implicit ctx: Context): DefKind = {
+ def createSymbol()(implicit ctx: Context): FlagSet = {
val start = currentAddr
val tag = readByte()
val end = readEnd()
@@ -409,10 +409,10 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
sym.completer.withDecls(newScope)
forkAt(templateStart).indexTemplateParams()(localContext(sym))
}
- if (isClass) NoInitDef
- else if (sym.isType || sym.isConstructor || flags.is(Deferred)) InterfaceDef
- else if (tag == VALDEF) GeneralDef
- else NoInitDef
+ if (isClass) NoInits
+ else if (sym.isType || sym.isConstructor || flags.is(Deferred)) NoInitsInterface
+ else if (tag == VALDEF) EmptyFlags
+ else NoInits
}
/** Read modifier list into triplet of flags, annotations and a privateWithin
@@ -476,25 +476,26 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
/** Create symbols for a definitions in statement sequence between
* current address and `end`.
- * @return true iff none of the statements contains initialization code
+ * @return the largest subset of {NoInits, PureInterface} that a
+ * trait owning the indexed statements can have as flags.
*/
- def indexStats(end: Addr)(implicit ctx: Context): DefKind = {
- val defKinds =
+ def indexStats(end: Addr)(implicit ctx: Context): FlagSet = {
+ val flagss =
until(end) {
nextByte match {
case VALDEF | DEFDEF | TYPEDEF | TYPEPARAM | PARAM =>
createSymbol()
case IMPORT =>
skipTree()
- InterfaceDef
+ NoInitsInterface
case PACKAGE =>
processPackage { (pid, end) => implicit ctx => indexStats(end) }
case _ =>
skipTree()
- GeneralDef
+ EmptyFlags
}
}
- (InterfaceDef /: defKinds)(_ min _)
+ (NoInitsInterface /: flagss)(_ & _)
}
/** Process package with given operation `op`. The operation takes as arguments
@@ -635,7 +636,7 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
}
else EmptyValDef
setClsInfo(parentRefs, if (self.isEmpty) NoType else self.tpt.tpe)
- cls.setFlagsFromDefKind(fork.indexStats(end))
+ cls.setApplicableFlags(fork.indexStats(end))
val constr = readIndexedDef().asInstanceOf[DefDef]
def mergeTypeParamsAndAliases(tparams: List[TypeDef], stats: List[Tree]): (List[Tree], List[Tree]) =