summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-04-10 12:51:57 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-04-21 13:02:04 +0200
commit510ebeca9e55b27bbe6e6c54bf0ea6ea294ee7be (patch)
tree46ee0b2ebf67722e84ce012489b96f4146629feb /src/compiler/scala/tools/nsc/typechecker/Contexts.scala
parentec5eaee3ec27b614c3ffe0496a755623c912cfdd (diff)
downloadscala-510ebeca9e55b27bbe6e6c54bf0ea6ea294ee7be.tar.gz
scala-510ebeca9e55b27bbe6e6c54bf0ea6ea294ee7be.tar.bz2
scala-510ebeca9e55b27bbe6e6c54bf0ea6ea294ee7be.zip
SI-7345 Prefer using a throwaway silent context over buffer flushing.
When we are using a throwaway silent context, we can just let it drift out of scope and over the horizon, rather than ceremoniously flushing its buffers on completion. - Applied to Scaladoc. - Applied to Infer#isApplicableSafe. Less manual error buffer management affords greater opportunity to cleanly express the logic. - Applied to `typerReportAnyContextErrors`. The reasoning for the last case is as follows: - There were only two callers to `typerReportAnyContextErrors`, and they both passed in as `c` a child context of `context`. - That child context must share the error reporting mode and buffer with `context`. - Therefore, extracting an error from `c` and issuing it into `context` is a no-op. Because the error buffer is Set, it was harmless. This part will probably textually conflict with the same change made in SI-7319, but the end results are identical.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Contexts.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 4b9d3fda01..4fc9cde070 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -261,11 +261,13 @@ trait Contexts { self: Analyzer =>
reportBuffer.clearAllErrors()
current
}
- /** Return and clear all warnings from the report buffer */
- def flushAndReturnWarningsBuffer(): immutable.Seq[(Position, String)] = {
- val current = reportBuffer.warnings
+
+ /** Issue and clear all warnings from the report buffer */
+ def flushAndIssueWarnings() {
+ reportBuffer.warnings foreach {
+ case (pos, msg) => unit.warning(pos, msg)
+ }
reportBuffer.clearAllWarnings()
- current
}
//