aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/reporting
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-21 09:28:22 +0100
committerMartin Odersky <odersky@gmail.com>2017-02-21 09:28:30 +0100
commit5f9e569926728e7f591a26729efa7700387aeb22 (patch)
tree435f8bc107e8def412ce00aef5fbc4d633ac1f53 /compiler/src/dotty/tools/dotc/reporting
parentf467be62da8978e506f58b702b84e74ef7ce09de (diff)
downloaddotty-5f9e569926728e7f591a26729efa7700387aeb22.tar.gz
dotty-5f9e569926728e7f591a26729efa7700387aeb22.tar.bz2
dotty-5f9e569926728e7f591a26729efa7700387aeb22.zip
Don't inline when errors are detected
Inlining is only well-defined if the body to inline does not have any errors. We therefore check for errors before we perform any transformation of trees related to inlining. The error check is global, i.e. we stop on any error not just on errors in the code to be inlined. This is a safe approximation, of course.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/reporting')
-rw-r--r--compiler/src/dotty/tools/dotc/reporting/Reporter.scala16
1 files changed, 0 insertions, 16 deletions
diff --git a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala
index 26c1e5ebc..b2c7abec9 100644
--- a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala
+++ b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala
@@ -171,22 +171,6 @@ trait Reporting { this: Context =>
throw ex
}
}
-
- /** Implements a fold that applies the function `f` to the result of `op` if
- * there are no new errors in the reporter
- *
- * @param op operation checked for errors
- * @param f function applied to result of op
- * @return either the result of `op` if it had errors or the result of `f`
- * applied to it
- */
- def withNoError[A, B >: A](op: => A)(f: A => B): B = {
- val before = reporter.errorCount
- val op0 = op
-
- if (reporter.errorCount > before) op0
- else f(op0)
- }
}
/**