diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-08-17 15:49:38 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-08-18 09:00:55 +0200 |
commit | ac430ac8ba554d1b976d44598400d95ce5cf3816 (patch) | |
tree | 92f709ec56cca5895cd960e82a1ebd10a34ad98a /src/compiler/scala/tools/nsc/Global.scala | |
parent | 7fc860963a4f76cb18e44c20f2bdfb49641033f3 (diff) | |
download | scala-ac430ac8ba554d1b976d44598400d95ce5cf3816.tar.gz scala-ac430ac8ba554d1b976d44598400d95ce5cf3816.tar.bz2 scala-ac430ac8ba554d1b976d44598400d95ce5cf3816.zip |
cleanup for macroExpand
Error reporting is moved to ContextErrors to disentangle stuff in Macros.scala.
With logics and error reporting intertwined it was an awful mess.
Exceptions are used for the same reason. Instead of threading failures through
the code polluting it with options/ifs, I outline the success path.
It worked much better for typedMacroBody, but I'm also happy with the resulting
code of macroExpand. To me a major factor towards applicability of exceptions
was that they are short-lived and that there might be max one error per domain,
after which we unconditionally bail.
Diffstat (limited to 'src/compiler/scala/tools/nsc/Global.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 574129a2f1..80e9ede271 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -1220,8 +1220,8 @@ class Global(var currentSettings: Settings, var reporter: Reporter) var reportedFeature = Set[Symbol]() - /** A flag whether macro expansions failed */ - var macroExpansionFailed = false + /** Has any macro expansion used a fallback during this run? */ + var seenMacroExpansionsFallingBack = false /** To be initialized from firstPhase. */ private var terminalPhase: Phase = NoPhase @@ -1511,7 +1511,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) else { allConditionalWarnings foreach (_.summarize) - if (macroExpansionFailed) + if (seenMacroExpansionsFallingBack) warning("some macros could not be expanded and code fell back to overridden methods;"+ "\nrecompiling with generated classfiles on the classpath might help.") // todo: migrationWarnings |