This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def NotVar(expr: Any): Any = macro NotVarImpl | |
def NotVarImpl(c: Context)(expr: c.Expr[Any]): c.Expr[Any] = { | |
import c.mirror._ | |
import reflect.api.Modifier.mutable | |
Expr((new Transformer{ | |
override def transform(tree:Tree):Tree = tree match{ | |
case ValDef(m,_,_,_) if m.hasModifier(mutable) => sys.error("can't use var !!!") | |
case _ => super.transform(tree) |