diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-05-27 23:07:03 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-05-28 10:19:20 +0200 |
commit | d5bfbd597e5fd4707b322c8bc13fd57f084ff1e4 (patch) | |
tree | 0d8297917784106c724212c600ef37e4ec23168c | |
parent | 363230a1a3882909936b5f32b97d590357b26bc6 (diff) | |
download | scala-d5bfbd597e5fd4707b322c8bc13fd57f084ff1e4.tar.gz scala-d5bfbd597e5fd4707b322c8bc13fd57f084ff1e4.tar.bz2 scala-d5bfbd597e5fd4707b322c8bc13fd57f084ff1e4.zip |
applying Jason's aesthetics suggestion
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Macros.scala | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala index 8d650b3653..baef84bc8e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala @@ -98,7 +98,11 @@ trait Macros extends FastTrack with MacroRuntimes with Traces with Helpers { signature: List[List[Int]], // type arguments part of a macro impl ref (the right-hand side of a macro definition) // these trees don't refer to a macro impl, so we can pickle them as is - targs: List[Tree]) + targs: List[Tree]) { + + // Was this binding derived from a `def ... = macro ???` definition? + def is_??? = className == Predef_???.owner.javaClassName && methName == Predef_???.name.encoded + } final val IMPLPARAM_TAG = 0 // actually it's zero and above, this is just a lower bound for >= checks final val IMPLPARAM_OTHER = -1 @@ -353,9 +357,7 @@ trait Macros extends FastTrack with MacroRuntimes with Traces with Helpers { else MacroTooFewArgumentListsError(expandee) } else { - val binding = loadMacroImplBinding(macroDef) - if (binding.className == Predef_???.owner.javaClassName && binding.methName == Predef_???.name.encoded) Nil - else { + def calculateMacroArgs(binding: MacroImplBinding) = { val signature = if (binding.isBundle) binding.signature else binding.signature.tail macroLogVerbose(s"binding: $binding") @@ -427,6 +429,10 @@ trait Macros extends FastTrack with MacroRuntimes with Traces with Helpers { // that's because macro impls can't have implicit parameters other than c.WeakTypeTag[T] (trees :+ tags).flatten } + + val binding = loadMacroImplBinding(macroDef) + if (binding.is_???) Nil + else calculateMacroArgs(binding) } macroLogVerbose(s"macroImplArgs: $macroImplArgs") MacroArgs(context, macroImplArgs) |