diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-05-22 22:21:10 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-05-22 22:21:10 +0200 |
commit | a907887158a469b6a21d027fd37bc360e9009b2f (patch) | |
tree | cbe260a6e1625cbaa33670289dfe78197d1fa5e5 /src/compiler/scala/tools/nsc/typechecker/Macros.scala | |
parent | d079e769b9372daae8d7770c4156f85ea1af6621 (diff) | |
download | scala-a907887158a469b6a21d027fd37bc360e9009b2f.tar.gz scala-a907887158a469b6a21d027fd37bc360e9009b2f.tar.bz2 scala-a907887158a469b6a21d027fd37bc360e9009b2f.zip |
adds MacroPlugin.pluginsIsBlackbox
This is an important omission in the current macro plugin API, which was
designed before the blackbox vs whitebox separation was implemented.
Even if one overrides pluginsTypedMacroBody and pluginsMacroExpand,
that would still be not enough to write a custom macro expander, because
typedImplicit1 uses isBlackbox, which is tightly coupled with the standard
way of reading/writing macro signatures.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Macros.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Macros.scala | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala index f4456998c0..aa7a570937 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala @@ -263,7 +263,12 @@ trait Macros extends MacroRuntimes with Traces with Helpers { } def isBlackbox(expandee: Tree): Boolean = isBlackbox(dissectApplied(expandee).core.symbol) - def isBlackbox(macroDef: Symbol): Boolean = { + def isBlackbox(macroDef: Symbol): Boolean = pluginsIsBlackbox(macroDef) + + /** Default implementation of `isBlackbox`. + * Can be overridden by analyzer plugins (see AnalyzerPlugins.pluginsIsBlackbox for more details) + */ + def standardIsBlackbox(macroDef: Symbol): Boolean = { val fastTrackBoxity = fastTrack.get(macroDef).map(_.isBlackbox) val bindingBoxity = loadMacroImplBinding(macroDef).map(_.isBlackbox) fastTrackBoxity orElse bindingBoxity getOrElse false |