From bf8e854c9f2dc2b03be5a44c84183af21510e6ef Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 12 Mar 2013 09:04:57 +0100 Subject: Split filterAsSeenFrom and generalized flag handling. 1. filterAsSeenFrom has been split again into its constituents "filterExcluded" and "asSeenFrom", and care was taken not to force the info unless we have to. The accessible check is no longer done when collecting members, because it would have forced the symbol through requesting privateWithin. 2. SymDenotation#is is tweaked to no longer force the denotation if the flags are in "FromStartFlags", i.e. set upon symbol creation. We can then eliminate special cases isModuleXXX, isPackageXXX. 3. Other tweaks mostly having to do with weakening sym.exists checks to avoid CyclicReference errros. --- src/dotty/tools/dotc/core/SymbolLoaders.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/dotty/tools/dotc/core/SymbolLoaders.scala') diff --git a/src/dotty/tools/dotc/core/SymbolLoaders.scala b/src/dotty/tools/dotc/core/SymbolLoaders.scala index 41f45fcbd..93e8ed64a 100644 --- a/src/dotty/tools/dotc/core/SymbolLoaders.scala +++ b/src/dotty/tools/dotc/core/SymbolLoaders.scala @@ -75,7 +75,7 @@ class SymbolLoaders { def enterClassAndModule(owner: Symbol, name: PreName, completer: SymbolLoader, flags: FlagSet = EmptyFlags)(implicit ctx: Context) { val clazz = enterClass(owner, name, completer, flags) val module = enterModule(owner, name, completer, flags) - /* + /* * !!! disabled for now because it causes CyclicReference. Need to revisit * if (!clazz.isAnonymousClass) { assert(clazz.companionModule == module, module) @@ -130,7 +130,7 @@ class SymbolLoaders { protected def description = "package loader " + classpath.name protected override def doComplete(root: SymDenotation) { - assert(root.isPackageClass, root) + assert(root is PackageClass, root) val pre = root.owner.thisType root.info = ClassInfo(pre, root.symbol.asClass, Nil, newScope, TermRef(pre, module)) if (!module.isCompleted) @@ -152,7 +152,7 @@ class SymbolLoaders { /** if there's a `package` member object in `pkgClass`, enter its members into it. */ def openPackageModule(pkgClass: ClassSymbol)(implicit ctx: Context) { val pkgModule = pkgClass.info.decl(nme.PACKAGEkw).symbol - if (pkgModule.isModule && + if ((pkgModule is Module) && (pkgModule.isCompleted || !pkgModule.completer.isInstanceOf[SourcefileLoader])) // println("open "+pkgModule)//DEBUG @@ -242,7 +242,7 @@ class ClassfileLoader(val classfile: AbstractFile)(implicit val cctx: CondensedC case d: ClassDenotation => d case d => throw new FatalError(s"linked class denot $d of $rootDenot is expected to be a ClassDenotation, but is a ${d.getClass}") } - if (rootDenot.isModuleClass) (linkedDenot, rootDenot) + if (rootDenot is ModuleClass) (linkedDenot, rootDenot) else (rootDenot, linkedDenot) } -- cgit v1.2.3