diff options
author | Paul Phillips <paulp@improving.org> | 2012-01-17 11:19:35 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-01-17 11:22:11 -0800 |
commit | 121bd609d82227446d1f638ecf5da9b604a77a13 (patch) | |
tree | 56d4ed9067cb502083fa4017952b323cfd3bb897 /src | |
parent | 2820770bffe2e7d180bccbcd7a3d83944b1dd8d6 (diff) | |
download | scala-121bd609d82227446d1f638ecf5da9b604a77a13.tar.gz scala-121bd609d82227446d1f638ecf5da9b604a77a13.tar.bz2 scala-121bd609d82227446d1f638ecf5da9b604a77a13.zip |
Revert "Fixing inliner visibility issue."
This reverts commit 2820770bffe2e7d180bccbcd7a3d83944b1dd8d6.
Last minute change had unintended consequences.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 96 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala | 45 |
2 files changed, 76 insertions, 65 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index f2786737aa..099145d3ae 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -439,58 +439,62 @@ abstract class ClassfileParser { // println("found: " + sym) sym } - - protected def lookupClass(name: Name) = { - val sym = name match { - case fulltpnme.RuntimeNothing => definitions.NothingClass - case fulltpnme.RuntimeNull => definitions.NullClass - case _ => - if (innerClasses contains name) // check inner classes - innerClasses.classSymbol(innerClasses(name).externalName) - else if (name containsChar '.') // qualified name - definitions.getClassIfDefined(name) - else // might be in the empty package - definitions.getMember(definitions.EmptyPackageClass, name.toTypeName) - } - - sym orElse loadClassSymbol(name) - } - protected def loadClassSymbol(name: Name): Symbol = { - val file = global.classPath findSourceFile ("" +name) getOrElse { - warning("Class " + name + " not found - continuing with a stub.") - return NoSymbol.newClass(name.toTypeName) - } - val completer = new global.loaders.ClassfileLoader(file) - var owner: Symbol = definitions.RootClass - var sym: Symbol = NoSymbol - var ss: Name = null - var start = 0 - var end = name indexOf '.' - - while (end > 0) { - ss = name.subName(start, end) - sym = owner.info.decls lookup ss - if (sym == NoSymbol) { - sym = owner.newPackage(ss) setInfo completer - sym.moduleClass setInfo completer - owner.info.decls enter sym + /** Return the class symbol of the given name. */ + def classNameToSymbol(name: Name): Symbol = { + def loadClassSymbol(name: Name): Symbol = { + val file = global.classPath findSourceFile ("" +name) getOrElse { + warning("Class " + name + " not found - continuing with a stub.") + return NoSymbol.newClass(name.toTypeName) + } + val completer = new global.loaders.ClassfileLoader(file) + var owner: Symbol = definitions.RootClass + var sym: Symbol = NoSymbol + var ss: Name = null + var start = 0 + var end = name indexOf '.' + + while (end > 0) { + ss = name.subName(start, end) + sym = owner.info.decls lookup ss + if (sym == NoSymbol) { + sym = owner.newPackage(ss) setInfo completer + sym.moduleClass setInfo completer + owner.info.decls enter sym + } + owner = sym.moduleClass + start = end + 1 + end = name.indexOf('.', start) } - owner = sym.moduleClass - start = end + 1 - end = name.indexOf('.', start) + ss = name.subName(0, start) + owner.info.decls lookup ss orElse { + sym = owner.newClass(ss.toTypeName) setInfoAndEnter completer + debuglog("loaded "+sym+" from file "+file) + sym + } + } + + def lookupClass(name: Name) = try { + if (name.pos('.') == name.length) + definitions.getMember(definitions.EmptyPackageClass, name.toTypeName) + else + definitions.getClass(name) // see tickets #2464, #3756 + } catch { + case _: FatalError => loadClassSymbol(name) } - ss = name.subName(0, start) - owner.info.decls lookup ss orElse { - sym = owner.newClass(ss.toTypeName) setInfoAndEnter completer - debuglog("loaded "+sym+" from file "+file) - sym + + innerClasses.get(name) match { + case Some(entry) => + //println("found inner class " + name) + val res = innerClasses.classSymbol(entry.externalName) + //println("\trouted to: " + res) + res + case None => + //if (name.toString.contains("$")) println("No inner class: " + name + innerClasses + " while parsing " + in.file.name) + lookupClass(name) } } - /** Return the class symbol of the given name. */ - def classNameToSymbol(name: Name): Symbol = lookupClass(name) - var sawPrivateConstructor = false def parseClass() { diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala index 489fc9ff54..3c97122c9c 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala @@ -160,27 +160,34 @@ abstract class ICodeReader extends ClassfileParser { } override def classNameToSymbol(name: Name) = { - val sym = ( - if (nme.isImplClassName(name)) { - val iface = lookupClass(nme.interfaceName(name)) - log("forcing " + iface.owner + " at phase: " + phase + " impl: " + iface.implClass) - iface.owner.info // force the mixin type-transformer - lookupClass(name.toTypeName) - } - else if (nme.isModuleName(name)) { - val strippedName = nme.stripModuleSuffix(name).toTermName - val sym = forceMangledName(strippedName.decodedName, true) - sym orElse definitions.getModule(strippedName) - } - else { - forceMangledName(name, false) - atPhase(currentRun.flattenPhase.next)(lookupClass(name)) - } - ) - if (sym.isModule) sym.moduleClass - else sym + val sym = if (name == fulltpnme.RuntimeNothing) + definitions.NothingClass + else if (name == fulltpnme.RuntimeNull) + definitions.NullClass + else if (nme.isImplClassName(name)) { + val iface = definitions.getClass(nme.interfaceName(name)) + log("forcing " + iface.owner + " at phase: " + phase + " impl: " + iface.implClass) + iface.owner.info // force the mixin type-transformer + definitions.getClass(name) + } + else if (nme.isModuleName(name)) { + val strippedName = nme.stripModuleSuffix(name) + val sym = forceMangledName(newTermName(strippedName.decode), true) + + if (sym == NoSymbol) definitions.getModule(strippedName) + else sym + } + else { + forceMangledName(name, false) + atPhase(currentRun.flattenPhase.next)(definitions.getClass(name)) + } + if (sym.isModule) + sym.moduleClass + else + sym } + var maxStack: Int = _ var maxLocals: Int = _ val JVM = ClassfileConstants // shorter, uppercase alias for use in case patterns |