Skip to content

Instantly share code, notes, and snippets.

@begeric
Created January 16, 2015 00:34
Show Gist options
  • Save begeric/909145a2948e745dfdd5 to your computer and use it in GitHub Desktop.
Save begeric/909145a2948e745dfdd5 to your computer and use it in GitHub Desktop.
def apply = (focus{case _: Defn.Def => true} andThen
collect[Set]{
case Term.Assign(b: Term.Name, _) => b
}.topDown feed { assigns =>
transform{
case t @ Defn.Var(a, (b: Term.Name) :: Nil, c, Some(d)) if !assigns.contains(b) =>
Defn.Val(a, b :: Nil, c, d) andCollect message(b, t)
}.topDown
}
).topDownBreak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment