diff options
author | Nicolas Stucki <nicolas.stucki@gmail.com> | 2016-07-20 14:53:41 +0200 |
---|---|---|
committer | Nicolas Stucki <nicolas.stucki@gmail.com> | 2016-07-20 14:53:41 +0200 |
commit | f32184a0fb340199d11e8a81c998dc0bd68fbac2 (patch) | |
tree | fe9768042abac545c781ef02330d683f42726143 | |
parent | 0536d1f3b77fd8332bf696a99cc1aefc82e8bf41 (diff) | |
download | dotty-f32184a0fb340199d11e8a81c998dc0bd68fbac2.tar.gz dotty-f32184a0fb340199d11e8a81c998dc0bd68fbac2.tar.bz2 dotty-f32184a0fb340199d11e8a81c998dc0bd68fbac2.zip |
Make -Xprint-diff an opt-in option.
* -Xprint:[...] alone prints the trees without diffs.
* -Xprint-diff enables the diff on -Xprint.
* -Xprint-diff-del enables the diff with deletes on -Xprint.
-rw-r--r-- | src/dotty/tools/dotc/Run.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/config/ScalaSettings.scala | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/Run.scala b/src/dotty/tools/dotc/Run.scala index 1c500c913..1a26748bf 100644 --- a/src/dotty/tools/dotc/Run.scala +++ b/src/dotty/tools/dotc/Run.scala @@ -92,8 +92,10 @@ class Run(comp: Compiler)(implicit ctx: Context) { last match { case SomePrintedTree(phase, lastTreeSting) if lastTreeSting != treeString => - val diff = DiffUtil.mkColoredCodeDiff(treeString, lastTreeSting, ctx.settings.XprintDiffDel.value) - ctx.echo(diff) + val msg = + if (!ctx.settings.XprintDiff.value && !ctx.settings.XprintDiffDel.value) treeString + else DiffUtil.mkColoredCodeDiff(treeString, lastTreeSting, ctx.settings.XprintDiffDel.value) + ctx.echo(msg) SomePrintedTree(squashedPhase.toString, treeString) case SomePrintedTree(phase, lastTreeSting) => diff --git a/src/dotty/tools/dotc/config/ScalaSettings.scala b/src/dotty/tools/dotc/config/ScalaSettings.scala index 30e4be1d5..b2fa745f1 100644 --- a/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -85,7 +85,8 @@ class ScalaSettings extends Settings.SettingGroup { val writeICode = PhasesSetting("-Xprint-icode", "Log internal icode to *.icode files after", "icode") val Xprintpos = BooleanSetting("-Xprint-pos", "Print tree positions, as offsets.") val printtypes = BooleanSetting("-Xprint-types", "Print tree types (debugging option).") - val XprintDiffDel = BooleanSetting("-Xprint-diff-del", "Print deleted parts of the tree since last print.") + val XprintDiff = BooleanSetting("-Xprint-diff", "Print changed parts of the tree since last print.") + val XprintDiffDel = BooleanSetting("-Xprint-diff-del", "Print chaged parts of the tree since last print including deleted parts.") val prompt = BooleanSetting("-Xprompt", "Display a prompt after each error (debugging option).") val script = StringSetting("-Xscript", "object", "Treat the source file as a script and wrap it in a main method.", "") val mainClass = StringSetting("-Xmain-class", "path", "Class for manifest's Main-Class entry (only useful with -d <jar>)", "") |