diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2013-07-30 22:26:38 -0700 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2013-07-30 22:26:38 -0700 |
commit | 3cb3c8e35c3df31a7f661903eca48cca557d5a49 (patch) | |
tree | dac4cab1e761330d6b61f4347a48c5c6051ca1e1 /src/compiler/scala/tools/nsc/GlobalSymbolLoaders.scala | |
parent | 115e8b4492851137ad2b5b61b9bf78bb51601dff (diff) | |
download | scala-3cb3c8e35c3df31a7f661903eca48cca557d5a49.tar.gz scala-3cb3c8e35c3df31a7f661903eca48cca557d5a49.tar.bz2 scala-3cb3c8e35c3df31a7f661903eca48cca557d5a49.zip |
Address TODOs around SymbolLoaders and SymbolTable.
SymbolTable refactoring introduced some TODOs that were supposed
to be addressed after M5 release. The reason I couldn't address
those problems right away was a conflict with our plans to modularize
Scaladoc and interactive. However, we decided to delay that work
until after M5 is released so addressing TODOs is not blocked
anymore.
This commit introduces the following changes:
* Eclipse project definitions for interactive and scaladoc
depend on scala-compiler project so they are builded against
latest version of the compiler (quick) instead of STARR.
This aligns our Eclipse project definitions with build.xml
structure.
* Introduce GlobalSymbolLoaders class which wires dependencies
of SymbolLoaders with assumption of dependency on Global.
* Switch to GlobalSymbolLoaders in BrowsingLoaders,
interactive Global and ScaladocGlobal; this eliminates all
TODO comments introduced before
Diffstat (limited to 'src/compiler/scala/tools/nsc/GlobalSymbolLoaders.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/GlobalSymbolLoaders.scala | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/GlobalSymbolLoaders.scala b/src/compiler/scala/tools/nsc/GlobalSymbolLoaders.scala new file mode 100644 index 0000000000..6921548230 --- /dev/null +++ b/src/compiler/scala/tools/nsc/GlobalSymbolLoaders.scala @@ -0,0 +1,30 @@ +/* NSC -- new Scala compiler + * Copyright 2005-2013 LAMP/EPFL + * @author Martin Odersky + */ + +package scala +package tools +package nsc + +/** + * Symbol loaders implementation that wires dependencies using Global. + */ +abstract class GlobalSymbolLoaders extends symtab.SymbolLoaders { + val global: Global + val symbolTable: global.type = global + val platform: symbolTable.platform.type + import global._ + def lookupMemberAtTyperPhaseIfPossible(sym: Symbol, name: Name): Symbol = { + def lookup = sym.info.member(name) + // if loading during initialization of `definitions` typerPhase is not yet set. + // in that case we simply load the member at the current phase + if (currentRun.typerPhase eq null) + lookup + else + enteringTyper { lookup } + } + + protected def compileLate(srcfile: io.AbstractFile): Unit = + currentRun.compileLate(srcfile) +} |