aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Contexts.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-08-14 16:07:59 +0200
committerMartin Odersky <odersky@gmail.com>2013-08-14 16:07:59 +0200
commitf19250b1a123aa63cf8f14096bfd8e29e7e548b2 (patch)
treea676a2d5c8e3dc494c4736c9d1454294b9b10341 /src/dotty/tools/dotc/core/Contexts.scala
parentc6f0c00790c996bea57ea905a830dedcb4f2bb44 (diff)
downloaddotty-f19250b1a123aa63cf8f14096bfd8e29e7e548b2.tar.gz
dotty-f19250b1a123aa63cf8f14096bfd8e29e7e548b2.tar.bz2
dotty-f19250b1a123aa63cf8f14096bfd8e29e7e548b2.zip
Integrated parser/typer into compiler
Some initial bug fixes. Added -explaintypes diagnostics.
Diffstat (limited to 'src/dotty/tools/dotc/core/Contexts.scala')
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index a193da372..6c2670d5d 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -14,7 +14,7 @@ import SymDenotations._
import util.Positions._
import ast.Trees._
import ast.untpd
-import util.{FreshNameCreator, SimpleMap}
+import util.{FreshNameCreator, SimpleMap, SourceFile, NoSource}
import typer._
import Implicits.ContextualImplicits
import config.Settings._
@@ -114,6 +114,11 @@ object Contexts {
def sstate: SettingsState = _sstate
/** The current tree */
+ private[this] var _compilationUnit: CompilationUnit = _
+ protected def compilationUnit_=(compilationUnit: CompilationUnit) = _compilationUnit = compilationUnit
+ def compilationUnit: CompilationUnit = _compilationUnit
+
+ /** The current tree */
private[this] var _tree: Tree[_ >: Untyped] = _
protected def tree_=(tree: Tree[_ >: Untyped]) = _tree = tree
def tree: Tree[_ >: Untyped] = _tree
@@ -227,7 +232,8 @@ object Contexts {
/** The current source file; will be derived from current
* compilation unit.
*/
- def source = util.NoSource // for now
+ def source: SourceFile =
+ if (compilationUnit == null) NoSource else compilationUnit.source
/** Does current phase use an erased types interpretation? */
def erasedTypes: Boolean = phase.erasedTypes
@@ -300,6 +306,7 @@ object Contexts {
def withRefinedPrinter(printer: Context => Printer): this.type = { this.refinedPrinter = printer; this }
def withOwner(owner: Symbol): this.type = { 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 }
def withScope(scope: Scope): this.type = { this.scope = scope; this }
def withNewScope: this.type = { this.scope = newScope; this }
@@ -444,6 +451,9 @@ object Contexts {
private[dotc] var indent = 0
protected[dotc] val indentTab = " "
+
+ /** Should warnings and errors containing non-sensical strings be suppressed? */
+ private[dotc] var suppressNonSensicalErrors = true
}
object Context {