diff options
author | Paul Phillips <paulp@improving.org> | 2012-10-28 12:22:24 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-11-09 16:47:52 -0700 |
commit | f56f9a3c4b7b9903c732658f052be1172dfd9baa (patch) | |
tree | f8f287398bc78129d11be9ba254ebff6260de480 /src/compiler/scala/tools/nsc/interpreter/Imports.scala | |
parent | 45c2d7f1dab5cb6a4afdac5e1d3f3d5caad86b62 (diff) | |
download | scala-f56f9a3c4b7b9903c732658f052be1172dfd9baa.tar.gz scala-f56f9a3c4b7b9903c732658f052be1172dfd9baa.tar.bz2 scala-f56f9a3c4b7b9903c732658f052be1172dfd9baa.zip |
Massively simplified repl name resolution.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/Imports.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/Imports.scala | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/Imports.scala b/src/compiler/scala/tools/nsc/interpreter/Imports.scala index 50db23b042..021f07002b 100644 --- a/src/compiler/scala/tools/nsc/interpreter/Imports.scala +++ b/src/compiler/scala/tools/nsc/interpreter/Imports.scala @@ -12,7 +12,7 @@ trait Imports { self: IMain => import global._ - import definitions.{ ScalaPackage, JavaLangPackage, PredefModule } + import definitions.{ ObjectClass, ScalaPackage, JavaLangPackage, PredefModule } import memberHandlers._ def isNoImports = settings.noimports.value @@ -104,7 +104,9 @@ trait Imports { * last one imported is actually usable. */ case class ComputedImports(prepend: String, append: String, access: String) - protected def importsCode(wanted: Set[Name]): ComputedImports = { + protected def importsCode(wanted0: Set[Name]): ComputedImports = { + val wanted = wanted0 filterNot isUnlinked + /** Narrow down the list of requests from which imports * should be taken. Removes requests which cannot contribute * useful imports for the specified set of wanted names. @@ -173,11 +175,11 @@ trait Imports { // the name of the variable, so that we don't need to // handle quoting keywords separately. case x => - for (imv <- x.definedNames) { - if (currentImps contains imv) addWrapper() + for (sym <- x.definedSymbols) { + if (currentImps contains sym.name) addWrapper() - code append ("import " + (req fullPath imv) + "\n") - currentImps += imv + code append (s"import ${x.path}\n") + currentImps += sym.name } } } |