Remove DefDef and check rhs

- lhs pattern matching occurs only for vals.
- def also breaks due to proc notation.
- instead of pretty printing, we can just check rhs.
This commit is contained in:
Eugene Yokota 2014-10-12 10:44:09 -05:00
parent 97584457fa
commit 7827682f41
1 changed files with 2 additions and 3 deletions

View File

@ -98,10 +98,9 @@ private[sbt] case class SbtParser(file: File, lines: Seq[String]) extends Parsed
// Check No val (a,b) = foo *or* val a,b = foo as these are problematic to range positions and the WHOLE architecture.
def isBadValDef(t: Tree): Boolean =
t match {
case (x @ (toolbox.u.ValDef(_, _, _, _) | toolbox.u.DefDef(_, _, _, _, _, _))) =>
case x @ toolbox.u.ValDef(_, _, _, rhs) if rhs != toolbox.u.EmptyTree =>
val content = modifiedContent.substring(x.pos.start, x.pos.end)
val prettyPrint = x.toString
(!(content contains "=") && (prettyPrint contains "="))
!(content contains "=")
case _ => false
}
parsedTrees.filter(isBadValDef).foreach { badTree =>