diff options
author | Martin Odersky <odersky@gmail.com> | 2014-03-06 11:25:57 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-03-07 11:12:34 +0100 |
commit | dbd5a4d22b6164b708a87b508d9b9f135b44a3ee (patch) | |
tree | f260c0ac27d161aa7eced5edf0906e354256770b /src/dotty/tools/dotc/core/Contexts.scala | |
parent | 2669fac03190a4b52b120e07896cf5cd3de208c6 (diff) | |
download | dotty-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/core/Contexts.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Contexts.scala | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index dd96023d7..9be2e2f43 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -119,10 +119,11 @@ object Contexts { protected def scope_=(scope: Scope) = _scope = scope def scope: Scope = _scope - /** The current typer */ - private[this] var _typer: Typer = _ - protected def typer_=(typer: Typer) = _typer = typer - def typer: Typer = _typer + /** The current type assigner ot typer */ + private[this] var _typeAssigner: TypeAssigner = _ + protected def typeAssigner_=(typeAssigner: TypeAssigner) = _typeAssigner = typeAssigner + def typeAssigner: TypeAssigner = _typeAssigner + def typer: Typer = _typeAssigner.asInstanceOf[Typer] /** The currently active import info */ private[this] var _importInfo: ImportInfo = _ @@ -312,7 +313,8 @@ object Contexts { def withTree(tree: Tree[_ >: Untyped]): this.type = { this.tree = tree; this } def withScope(scope: Scope): this.type = { this.scope = scope; this } def withNewScope: this.type = { this.scope = newScope; this } - def withTyper(typer: Typer): this.type = { this.typer = typer; this.scope = typer.scope; this } + def withTypeAssigner(typeAssigner: TypeAssigner): this.type = { this.typeAssigner = typeAssigner; this } + def withTyper(typer: Typer): this.type = { this.scope = typer.scope; withTypeAssigner(typer) } def withImportInfo(importInfo: ImportInfo): this.type = { this.importInfo = importInfo; this } def withRunInfo(runInfo: RunInfo): this.type = { this.runInfo = runInfo; this } def withDiagnostics(diagnostics: Option[StringBuilder]): this.type = { this.diagnostics = diagnostics; this } @@ -342,6 +344,7 @@ object Contexts { owner = NoSymbol sstate = settings.defaultState tree = untpd.EmptyTree + typeAssigner = TypeAssigner runInfo = new RunInfo(this) diagnostics = None moreProperties = Map.empty |