summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-10-28 12:43:47 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2016-10-28 12:43:47 +0200
commit795d59a8f600e45ee9b05b483a4d80d2d8ce6de5 (patch)
tree3f533e3a00006a73f7a33b3372d10af458100de5 /src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
parentae17256f1dcde4dd82008c6e355604d68d5a07b3 (diff)
downloadscala-795d59a8f600e45ee9b05b483a4d80d2d8ce6de5.tar.gz
scala-795d59a8f600e45ee9b05b483a4d80d2d8ce6de5.tar.bz2
scala-795d59a8f600e45ee9b05b483a4d80d2d8ce6de5.zip
Address review comments
Tighten some types (Symbol -> ClassSymbol / ModuleSymbol), use NonFatal instead of catching Throwable. Also don't run the classfile parser enteringPhase(phaseBeforeRefchecks) anymore. This was added in 0ccdb15 but seems no longer required.
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
index eb01c8dc44..d948d151a6 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
@@ -52,7 +52,7 @@ abstract class SymbolLoaders {
})
}
- def newClass(owner: Symbol, name: String): Symbol = owner.newClass(newTypeName(name))
+ def newClass(owner: Symbol, name: String): ClassSymbol = owner.newClass(newTypeName(name))
/** Enter class with given `name` into scope of `root`
* and give them `completer` as type.
@@ -60,12 +60,12 @@ abstract class SymbolLoaders {
def enterClass(owner: Symbol, name: String, completer: SymbolLoader): Symbol =
enterClass(owner, newClass(owner, name), completer)
- def enterClass(owner: Symbol, clazz: Symbol, completer: SymbolLoader): Symbol = {
+ def enterClass(owner: Symbol, clazz: ClassSymbol, completer: SymbolLoader): Symbol = {
clazz setInfo completer
enterIfNew(owner, clazz, completer)
}
- def newModule(owner: Symbol, name: String): Symbol = owner.newModule(newTermName(name))
+ def newModule(owner: Symbol, name: String): ModuleSymbol = owner.newModule(newTermName(name))
/** Enter module with given `name` into scope of `root`
* and give them `completer` as type.
@@ -73,7 +73,7 @@ abstract class SymbolLoaders {
def enterModule(owner: Symbol, name: String, completer: SymbolLoader): Symbol =
enterModule(owner, newModule(owner, name), completer)
- def enterModule(owner: Symbol, module: Symbol, completer: SymbolLoader): Symbol = {
+ def enterModule(owner: Symbol, module: ModuleSymbol, completer: SymbolLoader): Symbol = {
module setInfo completer
module.moduleClass setInfo moduleClassLoader
enterIfNew(owner, module, completer)
@@ -121,7 +121,7 @@ abstract class SymbolLoaders {
/** Enter class and module with given `name` into scope of `root`
* and give them `completer` as type.
*/
- def enterClassAndModule(root: Symbol, name: String, getCompleter: (Symbol, Symbol) => SymbolLoader) {
+ def enterClassAndModule(root: Symbol, name: String, getCompleter: (ClassSymbol, ModuleSymbol) => SymbolLoader) {
val clazz = newClass(root, name)
val module = newModule(root, name)
val completer = getCompleter(clazz, module)
@@ -281,7 +281,7 @@ abstract class SymbolLoaders {
}
}
- class ClassfileLoader(val classfile: AbstractFile, clazz: Symbol, module: Symbol) extends SymbolLoader with FlagAssigningCompleter {
+ class ClassfileLoader(val classfile: AbstractFile, clazz: ClassSymbol, module: ModuleSymbol) extends SymbolLoader with FlagAssigningCompleter {
private object classfileParser extends {
val symbolTable: SymbolLoaders.this.symbolTable.type = SymbolLoaders.this.symbolTable
} with ClassfileParser {
@@ -308,13 +308,7 @@ abstract class SymbolLoaders {
protected def doComplete(root: Symbol) {
val start = if (Statistics.canEnable) Statistics.startTimer(classReadNanos) else null
-
- // Running the classfile parser after refchecks can lead to "illegal class file dependency"
- // errors. More concretely, the classfile parser calls "sym.companionModule", which calls
- // "isModuleNotMethod" on the companion. After refchecks, this method forces the info, which
- // may run the classfile parser. This produces the error.
- enteringPhase(phaseBeforeRefchecks)(classfileParser.parse(classfile, clazz, module))
-
+ classfileParser.parse(classfile, clazz, module)
if (root.associatedFile eq NoAbstractFile) {
root match {
// In fact, the ModuleSymbol forwards its setter to the module class