diff options
author | Paul Phillips <paulp@improving.org> | 2013-03-05 10:09:34 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-03-09 11:03:11 -0800 |
commit | 9094822181c398b945b7f30ac1e2b05da9796f53 (patch) | |
tree | a3e5f0c7d2b821ce5d841dccd4007e4dca51a09b /src/compiler/scala/tools/nsc/typechecker/Namers.scala | |
parent | 960f9848897f2511a08d2a5908078a348dfb1716 (diff) | |
download | scala-9094822181c398b945b7f30ac1e2b05da9796f53.tar.gz scala-9094822181c398b945b7f30ac1e2b05da9796f53.tar.bz2 scala-9094822181c398b945b7f30ac1e2b05da9796f53.zip |
Enabling commit for interactive/scaladoc modules.
This is a non-behaviorally-changing setup commit which
re-routes bits of code through avenues which can more easily
be influenced by subclasses of Global.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index a1bf3a56c3..777e96da82 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -47,11 +47,23 @@ trait Namers extends MethodSynthesis { private class NormalNamer(context: Context) extends Namer(context) def newNamer(context: Context): Namer = new NormalNamer(context) - def newNamerFor(context: Context, tree: Tree): Namer = - newNamer(context.makeNewScope(tree, tree.symbol)) + def newNamerFor(context: Context, tree: Tree): Namer = newNamer(context.makeNewScope(tree, tree.symbol)) abstract class Namer(val context: Context) extends MethodSynth with NamerContextErrors { thisNamer => + def saveDefaultGetter(meth: Symbol, default: Symbol) { + if (forInteractive) { + // save the default getters as attachments in the method symbol. if compiling the + // same local block several times (which can happen in interactive mode) we might + // otherwise not find the default symbol, because the second time it the method + // symbol will be re-entered in the scope but the default parameter will not. + meth.attachments.get[DefaultsOfLocalMethodAttachment] match { + case Some(att) => att.defaultGetters += default + case None => meth.updateAttachment(new DefaultsOfLocalMethodAttachment(default)) + } + } + } + import NamerErrorGen._ val typer = newTyper(context) @@ -1297,17 +1309,10 @@ trait Namers extends MethodSynthesis { if (!isConstr) methOwner.resetFlag(INTERFACE) // there's a concrete member now val default = parentNamer.enterSyntheticSym(defaultTree) - if (forInteractive && default.owner.isTerm) { - // save the default getters as attachments in the method symbol. if compiling the - // same local block several times (which can happen in interactive mode) we might - // otherwise not find the default symbol, because the second time it the method - // symbol will be re-entered in the scope but the default parameter will not. - meth.attachments.get[DefaultsOfLocalMethodAttachment] match { - case Some(att) => att.defaultGetters += default - case None => meth.updateAttachment(new DefaultsOfLocalMethodAttachment(default)) - } - } - } else if (baseHasDefault) { + if (default.owner.isTerm) + saveDefaultGetter(meth, default) + } + else if (baseHasDefault) { // the parameter does not have a default itself, but the // corresponding parameter in the base class does. sym.setFlag(DEFAULTPARAM) |