aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Namer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-06 11:25:57 +0100
committerMartin Odersky <odersky@gmail.com>2014-03-07 11:12:34 +0100
commitdbd5a4d22b6164b708a87b508d9b9f135b44a3ee (patch)
treef260c0ac27d161aa7eced5edf0906e354256770b /src/dotty/tools/dotc/typer/Namer.scala
parent2669fac03190a4b52b120e07896cf5cd3de208c6 (diff)
downloaddotty-dbd5a4d22b6164b708a87b508d9b9f135b44a3ee.tar.gz
dotty-dbd5a4d22b6164b708a87b508d9b9f135b44a3ee.tar.bz2
dotty-dbd5a4d22b6164b708a87b508d9b9f135b44a3ee.zip
Scond step to typer reorg: Introduce TypeAssigners.
TypeAssigners assign a toplevel type to a node. They are mixed into Typer, and can be accessed from tpd using ctx.typeAssigner.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Namer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index 7d1e0629e..6e91e4754 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -58,14 +58,16 @@ trait NamerContextOps { this: Context =>
/** The symbol (stored in some typer's symTree) of an enclosing context definition */
def symOfContextTree(tree: untpd.Tree) = {
def go(ctx: Context): Symbol = {
- val typer = ctx.typer
- if (typer == null) NoSymbol
- else tree.getAttachment(typer.SymOfTree) match {
- case Some(sym) => sym
- case None =>
- var cx = ctx.outer
- while (cx.typer eq typer) cx = cx.outer
- go(cx)
+ ctx.typeAssigner match {
+ case typer: Typer =>
+ tree.getAttachment(typer.SymOfTree) match {
+ case Some(sym) => sym
+ case None =>
+ var cx = ctx.outer
+ while (cx.typeAssigner eq typer) cx = cx.outer
+ go(cx)
+ }
+ case _ => NoSymbol
}
}
go(this)