Skip to content

Commit 86aa733

Browse files
committed
refactor macro generation to use bundles when we need reuse.
1 parent 5daf874 commit 86aa733

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package gopher.util
2+
3+
import scala.reflect.macros.blackbox.Context
4+
5+
6+
trait ASTUtilImpl
7+
{
8+
val c: Context
9+
import c.universe._
10+
11+
def parseGuardInSelectorCaseDef(name: c.TermName, guard:c.Tree): c.Tree =
12+
{
13+
guard match {
14+
case Apply(Select(Ident(`name`),TermName("$eq$eq")),List(expression)) =>
15+
expression
16+
case _ =>
17+
c.abort(guard.pos, s"expected ${name}==<expression> in select guard")
18+
}
19+
}
20+
21+
}

0 commit comments

Comments
 (0)