diff options
author | Sean McDirmid <sean.mcdirmid@gmail.com> | 2008-07-25 12:27:02 +0000 |
---|---|---|
committer | Sean McDirmid <sean.mcdirmid@gmail.com> | 2008-07-25 12:27:02 +0000 |
commit | d1fb9078954b3e35cef3f6967ce39748a1011036 (patch) | |
tree | 2f5a515d3c9bacf9d4cf1625f440b060b1f2f432 | |
parent | eb79ac2f9da57cd611028de52fc5f47e79525c94 (diff) | |
download | scala-d1fb9078954b3e35cef3f6967ce39748a1011036.tar.gz scala-d1fb9078954b3e35cef3f6967ce39748a1011036.tar.bz2 scala-d1fb9078954b3e35cef3f6967ce39748a1011036.zip |
Hardening of plugin to convert more hard crashe...
Hardening of plugin to convert more hard crashes as soft ones.
-rw-r--r-- | src/compiler/scala/tools/nsc/IdeSupport.scala | 12 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 4 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/IdeSupport.scala b/src/compiler/scala/tools/nsc/IdeSupport.scala index 2f68ee5d01..91e7ea47a1 100644 --- a/src/compiler/scala/tools/nsc/IdeSupport.scala +++ b/src/compiler/scala/tools/nsc/IdeSupport.scala @@ -16,12 +16,18 @@ trait IdeSupport extends Global with symtab.IdeSupport { // load a source file without us caring about adapt. - def loadSource(file : AbstractFile) = { + def loadSource(file : AbstractFile) : Option[CompilationUnit] = { val run = new IdeRun reloadSource(file) val source = getSourceFile(file) - normalCompile(run.compileSources(source :: Nil)) - run.units.find(unit => unit.source == source) + try { + normalCompile(run.compileSources(source :: Nil)) + run.units.find(unit => unit.source == source) + } catch { + case e => + logError("error in presentation normal compile ", e) + None + } } object loaders1 extends { val global : IdeSupport.this.type = IdeSupport.this diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 71641e2c3a..20eaa5fe29 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -337,14 +337,14 @@ trait Contexts { self: Analyzer => def error(pos: Position, err: Error) { val msg = err.getMessage() - if (reportGeneralErrors) + if (reportGeneralErrors || inIDE) unit.error(pos, if (checking) "**** ERROR DURING INTERNAL CHECKING ****\n" + msg else msg) else throw err } def error(pos: Position, msg: String) { - if (reportGeneralErrors) + if (reportGeneralErrors || inIDE) unit.error(pos, if (checking) "**** ERROR DURING INTERNAL CHECKING ****\n" + msg else msg) else throw new TypeError(pos, msg) |