diff options
author | Martin Odersky <odersky@gmail.com> | 2013-08-19 16:19:03 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-08-19 16:19:03 +0200 |
commit | 62131749d08657a0103c922c626a0b918cf385b5 (patch) | |
tree | e8c49a9bb6eb41f3f5d4e3ca7e75a431a25c33b9 /src/dotty/tools/dotc/core/SymbolLoaders.scala | |
parent | edb9facac55f61540e0f9af8d06ac9390830fcb8 (diff) | |
download | dotty-62131749d08657a0103c922c626a0b918cf385b5.tar.gz dotty-62131749d08657a0103c922c626a0b918cf385b5.tar.bz2 dotty-62131749d08657a0103c922c626a0b918cf385b5.zip |
Several fixes and refactorings for typechecking
1) Refactoring of package loaders that ensures that a package is always loaded before new members are entered. This led to a refactoring of sourceModule in completers into its own trait
2) Refactoring of optSelfType ot selfInfo. Class Infos may now have a reference to a symbol in their selfInfo field, instead of always a type, as it was before. This allows to introduce laziness for self type evaluation. Laziness is needed so that modules can be desugared and the desugared version be compiled without special tricks.
3) <init> and $init members are no longer inherited.
4) Refactoring of createSymbol and enterSym, so that creating symbols and entering them in a scope is decoupled.
Renamed the driver operation form `enterSym(s)` to `index`.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymbolLoaders.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/SymbolLoaders.scala | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/SymbolLoaders.scala b/src/dotty/tools/dotc/core/SymbolLoaders.scala index dc65b77f4..2fbe147c7 100644 --- a/src/dotty/tools/dotc/core/SymbolLoaders.scala +++ b/src/dotty/tools/dotc/core/SymbolLoaders.scala @@ -142,13 +142,15 @@ class SymbolLoaders { /** Load contents of a package */ class PackageLoader(override val sourceModule: TermSymbol, classpath: ClassPath)(implicit val cctx: CondensedContext) - extends ClassCompleterWithDecls(newScope) with SymbolLoader { // !!! TODO: ClassCompleter needed? + extends SymbolLoader with ModuleClassCompleter { def description = "package loader " + classpath.name + private[core] val preDecls: MutableScope = newScope + def doComplete(root: SymDenotation) { assert(root is PackageClass, root) val pre = root.owner.thisType - root.info = ClassInfo(pre, root.symbol.asClass, Nil, root.decls, TermRef.withSym(pre, sourceModule)) + root.info = ClassInfo(pre, root.symbol.asClass, Nil, preDecls, TermRef.withSym(pre, sourceModule)) if (!sourceModule.isCompleted) sourceModule.completer.complete(sourceModule) if (!root.isRoot) { @@ -205,7 +207,7 @@ class SymbolLoaders { /** A lazy type that completes itself by calling parameter doComplete. * Any linked modules/classes or module classes are also initialized. */ -trait SymbolLoader extends LazyType { +abstract class SymbolLoader extends LazyType { implicit val cctx: CondensedContext /** Load source or class file for `root`, return */ |