summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/Global.scala
diff options
context:
space:
mode:
authorSean McDirmid <sean.mcdirmid@gmail.com>2006-03-03 17:26:45 +0000
committerSean McDirmid <sean.mcdirmid@gmail.com>2006-03-03 17:26:45 +0000
commita081275eebc315c31d59a35343a6d29d50287bec (patch)
tree2efd73460c003e5845a759540dae719317cf5993 /src/compiler/scala/tools/nsc/Global.scala
parentf9fed3d5ced2972575ec8d12a922e3fee165f21e (diff)
downloadscala-a081275eebc315c31d59a35343a6d29d50287bec.tar.gz
scala-a081275eebc315c31d59a35343a6d29d50287bec.tar.bz2
scala-a081275eebc315c31d59a35343a6d29d50287bec.zip
Initial checkin of new scala-doc tool.
Diffstat (limited to 'src/compiler/scala/tools/nsc/Global.scala')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 35373f9914..978bbf1da0 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -32,7 +32,6 @@ class Global(val settings: Settings, val reporter: Reporter) extends SymbolTable
with CompilationUnits
{
-
// sub-components --------------------------------------------------
object treePrinters extends TreePrinters {
@@ -83,7 +82,6 @@ class Global(val settings: Settings, val reporter: Reporter) extends SymbolTable
if (onlyPresentation) new HashMap[Symbol,String];
else null;
-
// reporting -------------------------------------------------------
def error(msg: String) = reporter.error(null, msg);
@@ -100,6 +98,27 @@ class Global(val settings: Settings, val reporter: Reporter) extends SymbolTable
def log(msg: Object): unit =
if (settings.log contains phase.name) inform("[log " + phase + "] " + msg);
+ class ErrorWithPosition(val pos : Int, val error : Throwable) extends Error;
+
+ def tryWith[T](pos : Int, body : => T) : T = try {
+ body;
+ } catch {
+ case e : ErrorWithPosition => throw e;
+ case te: TypeError => throw te;
+ case e : Error => throw new ErrorWithPosition(pos, e);
+ case e : RuntimeException => throw new ErrorWithPosition(pos, e);
+ }
+ def catchWith[T](source : SourceFile, body : => T) : T = try {
+ body;
+ } catch {
+ case e : ErrorWithPosition =>
+ logError("POS: " + source.dbg(e.pos), e);
+ throw e.error;
+ }
+
+
+
+
def logError(msg: String, t : Throwable): Unit = {};
def abort(msg: String) = throw new Error(msg);
@@ -305,7 +324,7 @@ class Global(val settings: Settings, val reporter: Reporter) extends SymbolTable
private var curRun: Run = NoRun;
override def currentRun: Run = curRun;
- def onlyPresentation = false;
+ def onlyPresentation = settings.doc.value;
class Run extends CompilerRun {
var currentUnit : CompilationUnit = _;