Skip to content
Snippets Groups Projects
Commit 9a21f4a1 authored by Nicolas Voirol's avatar Nicolas Voirol
Browse files

Improvement in typeParamsOf

parent 2072674c
Branches
Tags
No related merge requests found
...@@ -290,12 +290,19 @@ trait Types { self: Trees => ...@@ -290,12 +290,19 @@ trait Types { self: Trees =>
def getResult: Set[TypeParameter] = typeParams.toSet def getResult: Set[TypeParameter] = typeParams.toSet
override def traverse(tpe: Type): Unit = tpe match { override def traverse(tpe: Type): Unit = tpe match {
case tp: TypeParameter => case tp: TypeParameter => typeParams += tp
typeParams += tp case _ => super.traverse(tpe)
super.traverse(tp)
case _ =>
super.traverse(tpe)
} }
override def traverse(e: Expr): Unit = e match {
case v: Variable => ()
case _ => super.traverse(e)
}
}
def typeParamsOf2(t: Type): Set[TypeParameter] = t match {
case tp: TypeParameter => Set(tp)
case NAryType(tps, _) => tps.flatMap(typeParamsOf).toSet
} }
def typeParamsOf(e: Expr): Set[TypeParameter] = { def typeParamsOf(e: Expr): Set[TypeParameter] = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment