summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Macros.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-06-06 10:37:31 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-06-08 15:32:08 +0200
commit3896a416faffe337a96f873214b02f231f306174 (patch)
tree73280b539c520818adbd1a9e49d9d1344fbd5dc1 /src/compiler/scala/tools/nsc/typechecker/Macros.scala
parent6355d1a0b825c99560d4ccec1a8769f7421b1a71 (diff)
downloadscala-3896a416faffe337a96f873214b02f231f306174.tar.gz
scala-3896a416faffe337a96f873214b02f231f306174.tar.bz2
scala-3896a416faffe337a96f873214b02f231f306174.zip
miscellaneous cleanup, mostly fighting with feature warnings
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Macros.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala54
1 files changed, 28 insertions, 26 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index 93991fe7d5..7b55ea6c72 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -1103,34 +1103,36 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
else {
macroLogLite("typechecking macro expansion %s at %s".format(expandee, expandee.pos))
macroArgs(typer, expandee).fold(failExpansion(): MacroExpansionResult) {
- // [Eugene++] crashes virtpatmat:
- // case args @ ((context: MacroContext) :: _) =>
- case args @ (context0 :: _) =>
- val context = context0.asInstanceOf[MacroContext]
- if (nowDelayed) {
- macroLogLite("macro expansion is delayed: %s".format(expandee))
- delayed += expandee -> undetparams
- // need to save typer context for `macroExpandAll`
- // need to save macro context to preserve enclosures
- expandee addAttachment MacroRuntimeAttachment(delayed = true, typerContext = typer.context, macroContext = Some(context.asInstanceOf[MacroContext]))
- Delay(expandee)
- }
- else {
- // adding stuff to openMacros is easy, but removing it is a nightmare
- // it needs to be sprinkled over several different code locations
- // why? https://github.com/scala/scala/commit/bd3eacbae21f39b1ac7fe8ade4ed71fa98e1a28d#L2R1137
- // todo. will be improved
- openMacros ::= context
- var isSuccess = false
- try performExpansion(args) match {
- case x: Success => isSuccess = true ; x
- case x => x
+ args => (args: @unchecked) match {
+ // [Eugene++] crashes virtpatmat:
+ // case args @ ((context: MacroContext) :: _) =>
+ case args @ (context0 :: _) =>
+ val context = context0.asInstanceOf[MacroContext]
+ if (nowDelayed) {
+ macroLogLite("macro expansion is delayed: %s".format(expandee))
+ delayed += expandee -> undetparams
+ // need to save typer context for `macroExpandAll`
+ // need to save macro context to preserve enclosures
+ expandee addAttachment MacroRuntimeAttachment(delayed = true, typerContext = typer.context, macroContext = Some(context.asInstanceOf[MacroContext]))
+ Delay(expandee)
}
- finally {
- expandee.removeAttachment[MacroRuntimeAttachment]
- if (!isSuccess) openMacros = openMacros.tail
+ else {
+ // adding stuff to openMacros is easy, but removing it is a nightmare
+ // it needs to be sprinkled over several different code locations
+ // why? https://github.com/scala/scala/commit/bd3eacbae21f39b1ac7fe8ade4ed71fa98e1a28d#L2R1137
+ // todo. will be improved
+ openMacros ::= context
+ var isSuccess = false
+ try performExpansion(args) match {
+ case x: Success => isSuccess = true ; x
+ case x => x
+ }
+ finally {
+ expandee.removeAttachment[MacroRuntimeAttachment]
+ if (!isSuccess) openMacros = openMacros.tail
+ }
}
- }
+ }
}
}
}