summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Macros.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-12-07 14:13:58 +0100
committerEugene Burmako <xeno.by@gmail.com>2013-12-30 19:07:04 +0300
commit68b8e23585b5bbf7ff40d585634a7f07680c278b (patch)
tree0f37b8119f14471ede754768ba62db60c08c4869 /src/compiler/scala/tools/nsc/typechecker/Macros.scala
parent279e2e3b500c63b867d6f2c26a99aa44babfb8e4 (diff)
downloadscala-68b8e23585b5bbf7ff40d585634a7f07680c278b.tar.gz
scala-68b8e23585b5bbf7ff40d585634a7f07680c278b.tar.bz2
scala-68b8e23585b5bbf7ff40d585634a7f07680c278b.zip
hooks for typecheck and expansion of macro defs
Creates MacroPlugin, a sister interface of AnalyzerPlugin in the namer/typer extensibility interface. Exposes `pluginsTypedMacroBody`, `pluginsMacroExpand`, `pluginsMacroArgs` and `pluginsMacroRuntime` in the macro plugin interface. This will make it easy to prototype changes to the macro engine without disturbing scala/scala.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Macros.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index 8efd27a6d1..72783a3a61 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -562,7 +562,7 @@ trait Macros extends FastTrack with MacroRuntimes with Traces with Helpers {
onFailure(typer.infer.setError(expandee))
} else try {
val expanded = {
- val runtime = macroRuntime(expandee.symbol)
+ val runtime = pluginsMacroRuntime(expandee)
if (runtime != null) macroExpandWithRuntime(typer, expandee, runtime)
else macroExpandWithoutRuntime(typer, expandee)
}
@@ -689,7 +689,7 @@ trait Macros extends FastTrack with MacroRuntimes with Traces with Helpers {
else {
forced += delayed
typer.infer.inferExprInstance(delayed, typer.context.extractUndetparams(), outerPt, keepNothings = false)
- macroExpand(typer, delayed, mode, outerPt)
+ pluginsMacroExpand(typer, delayed, mode, outerPt)
}
} else delayed
}
@@ -731,12 +731,12 @@ trait Macros extends FastTrack with MacroRuntimes with Traces with Helpers {
case (false, true) =>
macroLogLite("macro expansion is delayed: %s".format(expandee))
delayed += expandee -> undetparams
- expandee updateAttachment MacroRuntimeAttachment(delayed = true, typerContext = typer.context, macroContext = Some(macroArgs(typer, expandee).c))
+ expandee updateAttachment MacroRuntimeAttachment(delayed = true, typerContext = typer.context, macroContext = Some(pluginsMacroArgs(typer, expandee).c))
Delay(expandee)
case (false, false) =>
import typer.TyperErrorGen._
macroLogLite("performing macro expansion %s at %s".format(expandee, expandee.pos))
- val args = macroArgs(typer, expandee)
+ val args = pluginsMacroArgs(typer, expandee)
try {
val numErrors = reporter.ERROR.count
def hasNewErrors = reporter.ERROR.count > numErrors
@@ -851,7 +851,7 @@ trait Macros extends FastTrack with MacroRuntimes with Traces with Helpers {
context.implicitsEnabled = typer.context.implicitsEnabled
context.enrichmentEnabled = typer.context.enrichmentEnabled
context.macrosEnabled = typer.context.macrosEnabled
- macroExpand(newTyper(context), tree, EXPRmode, WildcardType)
+ pluginsMacroExpand(newTyper(context), tree, EXPRmode, WildcardType)
case _ =>
tree
})