aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Contexts.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-01-02 10:14:18 +0100
committerMartin Odersky <odersky@gmail.com>2014-01-02 10:14:30 +0100
commit72e1e896d369a3872c49c26544d53f6e04436217 (patch)
tree13d527e686e0d0fc9063639bdf8b0fa5c23f0468 /src/dotty/tools/dotc/core/Contexts.scala
parent4907eb9e16597f1fce246555a45635c496b36264 (diff)
downloaddotty-72e1e896d369a3872c49c26544d53f6e04436217.tar.gz
dotty-72e1e896d369a3872c49c26544d53f6e04436217.tar.bz2
dotty-72e1e896d369a3872c49c26544d53f6e04436217.zip
Ensuring that contexts do not have NoSymbol as owner.
Diffstat (limited to 'src/dotty/tools/dotc/core/Contexts.scala')
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index ac0e243ff..816216a98 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -276,6 +276,10 @@ object Contexts {
final def addMode(mode: Mode): Context = withMode(this.mode | mode)
final def maskMode(mode: Mode): Context = withMode(this.mode & mode)
final def retractMode(mode: Mode): Context = withMode(this.mode &~ mode)
+
+ override def toString =
+ "Context(\n" +
+ (outersIterator map ( ctx => s" owner = ${ctx.owner}, scope = ${ctx.scope}") mkString "\n")
}
/** A condensed context provides only a small memory footprint over
@@ -296,7 +300,7 @@ object Contexts {
def withNewTyperState: this.type = withTyperState(typerState.fresh(isCommittable = true))
def withExploreTyperState: this.type = withTyperState(typerState.fresh(isCommittable = false))
def withPrinterFn(printer: Context => Printer): this.type = { this.printerFn = printer; this }
- def withOwner(owner: Symbol): this.type = { this.owner = owner; this }
+ def withOwner(owner: Symbol): this.type = { assert(owner != NoSymbol); this.owner = owner; this }
def withSettings(sstate: SettingsState): this.type = { this.sstate = sstate; this }
def withCompilationUnit(compilationUnit: CompilationUnit): this.type = { this.compilationUnit = compilationUnit; this }
def withTree(tree: Tree[_ >: Untyped]): this.type = { this.tree = tree; this }