diff options
author | nilday <howard.h.l@126.com> | 2016-09-16 17:25:25 +0000 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-11-07 02:08:39 -0500 |
commit | c89f87c9c9a0c7b256f225e37c55cb34f060aa6c (patch) | |
tree | d24a5ebc3c10a5a621885297aa957980a482e388 /libraries/eval/Eval.scala | |
parent | d89c9bdd16c7be729383acf438fcde4cdd863e9c (diff) | |
download | cbt-c89f87c9c9a0c7b256f225e37c55cb34f060aa6c.tar.gz cbt-c89f87c9c9a0c7b256f225e37c55cb34f060aa6c.tar.bz2 cbt-c89f87c9c9a0c7b256f225e37c55cb34f060aa6c.zip |
util-eval: Reset reporter while apply compiling
Problem
I notice that the former release 6.36.0 reset the reporter after
check(), which is not enough. In my use case, I would like to use
apply with resetState=false (or simply inPlace), without checking
it before (check method requires compiling every time, but apply
method has cache).
Under such circumstance, if I offer a piece of code with syntax
error, it will throw CompilerException every time even if I
correct it. It’s because the reporter hasn’t been reset.
Solution
Simply add resetReporter before compile will solve the problem.
Signed-off-by: Christopher Coco <ccoco@twitter.com>
RB_ID=871408
Diffstat (limited to 'libraries/eval/Eval.scala')
-rw-r--r-- | libraries/eval/Eval.scala | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libraries/eval/Eval.scala b/libraries/eval/Eval.scala index abd1836..1ab5762 100644 --- a/libraries/eval/Eval.scala +++ b/libraries/eval/Eval.scala @@ -581,6 +581,9 @@ class Eval(target: Option[File]) { if (Debug.enabled) Debug.printWithLineNumbers(code) + //reset reporter, or will always throw exception after one error while resetState==false + resetReporter() + // if you're looking for the performance hit, it's 1/2 this line... val compiler = new global.Run val sourceFiles = List(new BatchSourceFile("(inline)", code)) |